我正在尝试通过 Package Explorer Export > Export Android Application 中的内置 Proguard 支持来使用 Proguard。主项目正在使用一个库项目,该库项目又使用 android 兼容性库,它也使用这个兼容性库本身。基本上是这样的:
BaseLibraryProject BaseActivity libs:android-support-v4.jar MainProject 使用库 BaseLibraryProject libs:android-support-v4.jar
这个应用程序在设备和模拟器上都可以正常运行。但是 Proguard 会发出很多警告,并且与代码 1 一起存在。
这是 Proguard 相关列表的最后一点:
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView$OnQueryTextListener
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb$1: can't find referenced class android.widget.SearchView$OnQueryTextListener
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb$1: can't find referenced class android.widget.SearchView
[2012-04-09 14:19:49 - MainProject] Warning: there were 131 unresolved references to classes or interfaces.
[2012-04-09 14:19:49 - MainProject] You may need to specify additional library jars (using '-libraryjars').
[2012-04-09 14:19:49 - MainProject] Warning: there were 29 unresolved references to program class members.
[2012-04-09 14:19:49 - MainProject] Your input classes appear to be inconsistent.
[2012-04-09 14:19:49 - MainProject] You may need to recompile them and try again.
[2012-04-09 14:19:49 - MainProject] Alternatively, you may have to specify the option
[2012-04-09 14:19:49 - MainProject] '-dontskipnonpubliclibraryclassmembers'.
[2012-04-09 14:19:49 - MainProject] java.io.IOException: Please correct the above warnings first.
如您所见:它找不到兼容性库。
这是包含 -libraryjars 和 -dontskipnonpubliclibraryclassmembers 的 proguard.cfg 文件的开始:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-libraryjars libs/android-support-v4.jar
没有什么区别。我尝试了将库添加到 BaseLibrary 项目/MainProject 的各种组合,完全限定的路径名。似乎没有任何帮助。
proguard 上的大多数 stackoverflow 问题似乎都与设置 Ant 相关。知道什么可能导致这个问题,以及如何让 Proguard 在这个使用多个库的项目上工作吗?
提前致谢,