直接使用会报错:
C:\Users\Administrator\Desktop\GitHub\android-resource-remover-master\test\android_app>lint --check UnusedResources ./ --xml lint-result.xml && android-resource-remover
Scanning android_app: ................
Scanning android_app (Phase 2): ...........
Wrote XML report to C:\Users\Administrator\Desktop\GitHub\android-resource-remov
er-master\test\android_app\lint-result.xml
Lint found 1 errors and 12 warnings
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\android-resource-remover.exe\__main__.py", line 9, i
n <module>
File "c:\python27\lib\site-packages\android_clean_app.py", line 141, in main
lint_result_path, app_dir, ignore_layouts = run_lint_command()
File "c:\python27\lib\site-packages\android_clean_app.py", line 77, in run_lin
t_command
call_result = subprocess.call([lint, app_dir, '--xml', lint_result])
File "c:\python27\lib\subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "c:\python27\lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "c:\python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2]
应该换种使用方式,指定lint:
android-resource-remover --lint D:\DevUtils\Android\SDK\tools\lint.bat --xml lint-result.xml
这样就使用成功了:
C:\Users\Administrator\Desktop\GitHub\android-resource-remover-master\test\andro
id_app>android-resource-remover --lint D:\DevUtils\Android\SDK\tools\lint.bat --
xml lint-result.xml
removing resource: .\res\anim\anim_missing.xml
removing resource: .\res\animator\animator_missing.xml
removing resource: .\res\color\color_missing.xml
removing ('dimen', 'missing_dimen') from resource .\res\values\dimens.xml
removing resource: .\res\drawable\drawable_missing.xml
removing resource: .\res\drawable-hdpi\ic_launcher.png
removing resource: .\res\drawable-ldpi\ic_launcher.png
removing resource: .\res\drawable-mdpi\ic_launcher.png
removing resource: .\res\drawable-xhdpi\ic_launcher.png
removing resource: .\res\layout\layout_missing.xml
removing resource: .\res\menu\menu_missing.xml
removing ('string', 'missing') from resource .\res\values\strings.xml
removing ('string', 'missing') from resource .\res\values-fr\strings.xml
removing ('string', 'extra_translation') from resource .\res\values-fr\strings.x
ml
removing resource: .\res\xml\xml_missing.xml