1

使用 ANT 1.8.2 和 proguarg 4.8.1 构建项目时

 [proguard] Unexpected error while evaluating instruction:
 [proguard]   Class       = [android/support/v4/view/AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl]
 [proguard]   Method      = [newAccessiblityDelegateBridge(Landroid/support/v4/view/AccessibilityDelegateCompat;)Ljava/lang/Object;]
 [proguard]   Instruction = [18] areturn
 [proguard]   Exception   = [java.lang.IllegalArgumentException] (Can't find any super classes of [android/support/v4/view/AccessibilityDelegateCompatIcs$1] (not even immediate super class [android/view/View$AccessibilityDelegate]))
 [proguard] Unexpected error while performing partial evaluation:
 [proguard]   Class       = [android/support/v4/view/AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl]
 [proguard]   Method      = [newAccessiblityDelegateBridge(Landroid/support/v4/view/AccessibilityDelegateCompat;)Ljava/lang/Object;]
 [proguard]   Exception   = [java.lang.IllegalArgumentException] (Can't find any super classes of [android/support/v4/view/AccessibilityDelegateCompatIcs$1] (not even immediate super class [android/view/View$AccessibilityDelegate]))

BUILD FAILED
E:\adt-bundle-windows\sdk\tools\ant\build.xml:864: java.lang.IllegalArgumentException:     Can't find any super classes of [android/support/v4/view/AccessibilityDelegateCompatIcs$1] (not even immediate super class [android/view/View$AccessibilityDelegate])

android-support-v4.jar在类路径和项目依赖项中...从Eclipse所有but debug版本都构建好。Ant 显示这些错误...

如何避免这种情况?我知道如果Eclipse构建这个可以,Ant也必须构建..

PS我的项目是android-10目标,如果有人建议,我不想也不能使它成为目标16...

4

2 回答 2

2

您应该指定一个目标 SDK project.properties,在这种情况下包含“android.view.View$AccessibilityDelegate”(SDK 级别 14 或更高)。ProGuard 的收缩/优化/混淆至少需要与用于编译应用程序及其库的基本 SDK相同。支持库是针对这个更新的 SDK 编译的,所以 ProGuard 也需要它。

您仍然可以在您的AndroidManifest.xml, 中指定不同的目标/最小/最大 SDK 来运行应用程序。您当然应该确保应用程序确实与那些指定的 SDK 兼容。

于 2013-03-04T22:24:17.353 回答
2

尝试将这些添加到您的 proguard.cf 中怎么样?

-libraryjars   libs/android-support-v4.jar
-dontwarn android.support.v4.**    
-keep class android.support.v4.** { *; }  
-keep interface android.support.v4.app.** { *; }  
-keep public class * extends android.support.v4.**  
-keep public class * extends android.app.Fragment
于 2013-02-28T16:53:52.220 回答