studio中可能遇到的.9-patch图片报错处理

本文介绍如何在build.gradle中配置以禁用Android Studio对PNG文件的合法性检查,通过添加特定设置来避免因PNG问题导致的构建错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在build.gradle里添加以下两句:
aaptOptions.cruncherEnabled = false 
aaptOptions.useNewCruncher = false,


就直接添加到buildToolsVersion的下方即可。这个可以关闭Android Studio的PNG合法性检查。。。然后就可以大胆的用图了。。。
命令行运行pip install dlib==19.24.0 --no-cache-dir --verbose报错: Using pip 25.1.1 from D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip (python 3.13) Collecting dlib==19.24.0 Downloading dlib-19.24.0.tar.gz (3.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 100.9 kB/s eta 0:00:00 Running command python setup.py egg_info C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:212: SyntaxWarning: invalid escape sequence &#39;\(&#39; major = re.findall("set\(CPACK_PACKAGE_VERSION_MAJOR.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:213: SyntaxWarning: invalid escape sequence &#39;\(&#39; minor = re.findall("set\(CPACK_PACKAGE_VERSION_MINOR.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:214: SyntaxWarning: invalid escape sequence &#39;\(&#39; patch = re.findall("set\(CPACK_PACKAGE_VERSION_PATCH.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:194: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated. !! ******************************************************************************** Please remove any references to `setuptools.command.test` in all supported versions of the affected package. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. ******************************************************************************** !! from setuptools.command.test import test as TestCommand D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py:289: UserWarning: Unknown distribution option: &#39;tests_require&#39; warnings.warn(msg) running egg_info creating C:\Users\徐庆凯\AppData\Local\Temp\pip-pip-egg-info-x4hwlbut\dlib.egg-info writing C:\Users\徐庆凯\AppData\Local\Temp\pip-pip-egg-info-x4hwlbut\dlib.egg-info\PKG-INFO writing dependency_links to C:\Users\徐庆凯\AppData\Local\Temp\pip-pip-egg-info-x4hwlbut\dlib.egg-info\dependency_links.txt writing top-level names to C:\Users\徐庆凯\AppData\Local\Temp\pip-pip-egg-info-x4hwlbut\dlib.egg-info\top_level.txt writing manifest file &#39;C:\Users\徐庆凯\AppData\Local\Temp\pip-pip-egg-info-x4hwlbut\dlib.egg-info\SOURCES.txt&#39; reading manifest file &#39;C:\Users\徐庆凯\AppData\Local\Temp\pip-pip-egg-info-x4hwlbut\dlib.egg-info\SOURCES.txt&#39; reading manifest template &#39;MANIFEST.in&#39; no previously-included directories found matching &#39;tools\python\build*&#39; no previously-included directories found matching &#39;dlib\cmake_utils\*\build*&#39; no previously-included directories found matching &#39;dlib\test&#39; warning: no previously-included files matching &#39;*.pyc&#39; found anywhere in distribution writing manifest file &#39;C:\Users\徐庆凯\AppData\Local\Temp\pip-pip-egg-info-x4hwlbut\dlib.egg-info\SOURCES.txt&#39; Preparing metadata (setup.py) ... done Building wheels for collected packages: dlib DEPRECATION: Building &#39;dlib&#39; using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of &#39;dlib&#39;. Discussion can be found at https://github.com/pypa/pip/issues/6334 Running command python setup.py bdist_wheel C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:212: SyntaxWarning: invalid escape sequence &#39;\(&#39; major = re.findall("set\(CPACK_PACKAGE_VERSION_MAJOR.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:213: SyntaxWarning: invalid escape sequence &#39;\(&#39; minor = re.findall("set\(CPACK_PACKAGE_VERSION_MINOR.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:214: SyntaxWarning: invalid escape sequence &#39;\(&#39; patch = re.findall("set\(CPACK_PACKAGE_VERSION_PATCH.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:194: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated. !! ******************************************************************************** Please remove any references to `setuptools.command.test` in all supported versions of the affected package. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. ******************************************************************************** !! from setuptools.command.test import test as TestCommand D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py:289: UserWarning: Unknown distribution option: &#39;tests_require&#39; warnings.warn(msg) running bdist_wheel running build running build_py running build_ext C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if LooseVersion(cmake_version) < &#39;3.1.0&#39;: Building extension for Python 3.13.5 (tags/v3.13.5:6cb20a2, Jun 11 2025, 16:15:46) [MSC v.1943 64 bit (AMD64)] Invoking CMake setup: &#39;cmake C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\build\lib.win-amd64-cpython-313 -DPYTHON_EXECUTABLE=D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\build\lib.win-amd64-cpython-313 -A x64&#39; Traceback (most recent call last): File "<string>", line 2, in <module> exec(compile(&#39;&#39;&#39; ~~~~^^^^^^^^^^^^ # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<32 lines>... exec(compile(setup_py_code, filename, "exec")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ &#39;&#39;&#39; % (&#39;C:\\Users\\徐庆凯\\AppData\\Local\\Temp\\pip-install-1bugzpia\\dlib_3252fe8772d348fc97cbac2fb469313f\\setup.py&#39;,), "<pip-setuptools-caller>", "exec")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<pip-setuptools-caller>", line 35, in <module> File "C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py", line 222, in <module> setup( ~~~~~^ name=&#39;dlib&#39;, ^^^^^^^^^^^^ ...<38 lines>... ], ^^ ) ^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\__init__.py", line 115, in setup return distutils.core.setup(**attrs) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup return run_commands(dist) File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands dist.run_commands() ~~~~~~~~~~~~~~~~~^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands self.run_command(cmd) ~~~~~~~~~~~~~~~~^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() ~~~~~~~~~~~^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\command\bdist_wheel.py", line 370, in run self.run_command("build") ~~~~~~~~~~~~~~~~^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command self.distribution.run_command(command) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() ~~~~~~~~~~~^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run self.run_command(cmd_name) ~~~~~~~~~~~~~~~~^^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command self.distribution.run_command(command) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() ~~~~~~~~~~~^^ File "C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py", line 134, in run self.build_extension(ext) ~~~~~~~~~~~~~~~~~~~~^^^^^ File "C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py", line 171, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 419, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command &#39;[&#39;cmake&#39;, &#39;C:\\Users\\徐庆凯\\AppData\\Local\\Temp\\pip-install-1bugzpia\\dlib_3252fe8772d348fc97cbac2fb469313f\\tools\\python&#39;, &#39;-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\徐庆凯\\AppData\\Local\\Temp\\pip-install-1bugzpia\\dlib_3252fe8772d348fc97cbac2fb469313f\\build\\lib.win-amd64-cpython-313&#39;, &#39;-DPYTHON_EXECUTABLE=D:\\Users\\徐庆凯\\AppData\\Local\\Programs\\Python\\Python313\\python.exe&#39;, &#39;-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\徐庆凯\\AppData\\Local\\Temp\\pip-install-1bugzpia\\dlib_3252fe8772d348fc97cbac2fb469313f\\build\\lib.win-amd64-cpython-313&#39;, &#39;-A&#39;, &#39;x64&#39;]&#39; returned non-zero exit status 3221226505. error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: &#39;D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\python.exe&#39; -u -c &#39; exec(compile(&#39;"&#39;"&#39;&#39;"&#39;"&#39;&#39;"&#39;"&#39; # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py # # - It imports setuptools before invoking setup.py, to enable projects that directly # import from `distutils.core` to work with newer packaging standards. # - It provides a clear error message when setuptools is not installed. # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so # setuptools doesn&#39;"&#39;"&#39;t think the script is `-c`. This avoids the following warning: # manifest_maker: standard file &#39;"&#39;"&#39;-c&#39;"&#39;"&#39; not found". # - It generates a shim setup.py, for handling setup.cfg-only projects. import os, sys, tokenize, traceback try: import setuptools except ImportError: print( "ERROR: Can not execute `setup.py` since setuptools failed to import in " "the build environment with exception:", file=sys.stderr, ) traceback.print_exc() sys.exit(1) __file__ = %r sys.argv[0] = __file__ if os.path.exists(__file__): filename = __file__ with tokenize.open(__file__) as f: setup_py_code = f.read() else: filename = "<auto-generated setuptools caller>" setup_py_code = "from setuptools import setup; setup()" exec(compile(setup_py_code, filename, "exec")) &#39;"&#39;"&#39;&#39;"&#39;"&#39;&#39;"&#39;"&#39; % (&#39;"&#39;"&#39;C:\\Users\\徐庆凯\\AppData\\Local\\Temp\\pip-install-1bugzpia\\dlib_3252fe8772d348fc97cbac2fb469313f\\setup.py&#39;"&#39;"&#39;,), "<pip-setuptools-caller>", "exec"))&#39; bdist_wheel -d &#39;C:\Users\徐庆凯\AppData\Local\Temp\pip-wheel-m03b8zax&#39; cwd: C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\\ Building wheel for dlib (setup.py) ... error ERROR: Failed building wheel for dlib Running setup.py clean for dlib Running command python setup.py clean C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:212: SyntaxWarning: invalid escape sequence &#39;\(&#39; major = re.findall("set\(CPACK_PACKAGE_VERSION_MAJOR.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:213: SyntaxWarning: invalid escape sequence &#39;\(&#39; minor = re.findall("set\(CPACK_PACKAGE_VERSION_MINOR.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:214: SyntaxWarning: invalid escape sequence &#39;\(&#39; patch = re.findall("set\(CPACK_PACKAGE_VERSION_PATCH.*\"(.*)\"", open(cmake_file).read())[0] C:\Users\徐庆凯\AppData\Local\Temp\pip-install-1bugzpia\dlib_3252fe8772d348fc97cbac2fb469313f\setup.py:194: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated. !! ******************************************************************************** Please remove any references to `setuptools.command.test` in all supported versions of the affected package. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. ******************************************************************************** !! from setuptools.command.test import test as TestCommand D:\Users\徐庆凯\AppData\Local\Programs\Python\Python313\Lib\site-packages\setuptools\_distutils\dist.py:289: UserWarning: Unknown distribution option: &#39;tests_require&#39; warnings.warn(msg) running clean removing &#39;build\temp.win-amd64-cpython-313&#39; (and everything under it) &#39;build\lib.win-amd64-cpython-313&#39; does not exist -- can&#39;t clean it &#39;build\bdist.win-amd64&#39; does not exist -- can&#39;t clean it &#39;build\scripts-3.13&#39; does not exist -- can&#39;t clean it removing &#39;build&#39; Failed to build dlib ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)
06-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值