我有一个相当大的项目,有一个精心设计的保护.cfg .
- 这个项目在 eclipse 下构建正常,proguard 运行没有错误,并且应用程序运行良好,这是我几个月来的正常工作。
我正在尝试使用 ant 从命令行构建它。
我已经更新了项目及其库项目的构建.xml等,使用
android update project -p .
android update project -s --target android-17 -p .
- 调试版本
ant debug
成功生成 - 然而,
ant release
proguard
失败,抱怨缺课。
从我所能破译的内容(弹出许多非 faltal 警告)来看,这些问题与我的一个(千个)类中缺少内部类以及依赖库项目缺少 R(资源)有关。这很奇怪,这两件事都存在,库项目从 eclipse 和 ant 构建正常,我不知道那个内部类,父类非常微不足道。
为什么它在 eclipse 下构建而不使用命令行?更新的构建脚本不应该产生相同的结果吗?
Proguard:与 LIbrary 项目资源相关的错误
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
Proguard:未找到与内部类相关的
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$2: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$3: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
这很奇怪,我通过反复试验发现了问题。
未找到的内部类是一个无辜的私人匿名可运行,如下所示:
private Runnable mBlinkRunner=new Runnable() {
public void run() {
.
. couple simple lines
.
}
};
我把它改成了...
protected Runnable mBlinkRunner=new Runnable() {
public void run() {
.
. couple simple lines
.
}
};
它奏效了...我想知道为什么会发生这种情况,整个项目中应该有数百个这样的可运行对象。