1

While building project using ANT 1.8.2 and 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 is in class path and project dependecies... From Eclipse all but debug version is built OK. Ant display those errors...

How do avoid this? I understand if Eclipse builds this OK, the Ant have to build too..

P.S. My project is android-10 target and I don't want and can't make it target-16 if somebody'll advise...

Oleg Karakoz
  • 532
  • 1
  • 6
  • 18

2 Answers2

2

what about try to add these to your 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
Mikonos
  • 161
  • 6
2

You should specify a target SDK in your project.properties that in this case contains 'android.view.View$AccessibilityDelegate' (SDK level 14 or higher). ProGuard's shrinking/optimization/obfuscation need at least the same base SDK that was used for compiling the application and its libraries. The support library was compiled against this more recent SDK, so ProGuard needs it as well.

You can still specify a different target/min/max SDK in your AndroidManifest.xml, for running the application. You should of course make sure that the application is indeed compatible with those specified SDKs.

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
  • I'm having this same issue and your advice solved it. My concern is this: the documentation stipulates that specifying a target version below SDK 14 enables certain legacy options (e.g. options menu). If I specify a build target of SDK 14 will that cause my application not to have these compatibility features when run on a SDK 14+ device? – jph Apr 11 '13 at 22:17
  • 1
    @user190758 If I'm not mistaking, the documentation refers to the target version in AndroidManifest.xml, which you can set freely. – Eric Lafortune Apr 18 '13 at 00:54