使用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
也必须构建......
P.S。我的项目是android-10目标,如果有人建议,我不想让它成为目标-16。
答案 0 :(得分: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
答案 1 :(得分:2)
您应该在project.properties
中指定目标SDK,在这种情况下包含'android.view.View $ AccessibilityDelegate'(SDK级别14或更高级别)。 ProGuard的缩小/优化/混淆至少需要用于编译应用程序和其库的基本SDK。支持库是针对这个更新的SDK编译的,因此ProGuard也需要它。
您仍然可以在AndroidManifest.xml
中指定不同的目标/最小/最大SDK,以便运行该应用程序。您当然应该确保应用程序确实与那些指定的SDK兼容。