使用android-resource-remover遇到的问题

在尝试使用android-resource-remover时遇到了报错,但通过改变使用方法,特别是指定使用lint,成功地避免了错误并完成了资源移除操作。

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

直接使用会报错:


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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值