java - Android Holoeverywhere Proguard hell -


i getting following error while testing app in release mode, proguard obfuscation:

08-09 21:44:06.140: e/androidruntime(4465): fatal exception: main 08-09 21:44:06.140: e/androidruntime(4465): java.lang.exceptionininitializererror 08-09 21:44:06.140: e/androidruntime(4465):     @ java.lang.class.newinstanceimpl(native method) 08-09 21:44:06.140: e/androidruntime(4465):     @ java.lang.class.newinstance(class.java:1409) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.app.instrumentation.newapplication(instrumentation.java:957) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.app.instrumentation.newapplication(instrumentation.java:942) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.app.loadedapk.makeapplication(loadedapk.java:461) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.app.activitythread.handlebindapplication(activitythread.java:3264) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.app.activitythread.access$2200(activitythread.java:117) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.app.activitythread$h.handlemessage(activitythread.java:973) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.os.handler.dispatchmessage(handler.java:99) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.os.looper.loop(looper.java:123) 08-09 21:44:06.140: e/androidruntime(4465):     @ android.app.activitythread.main(activitythread.java:3687) 08-09 21:44:06.140: e/androidruntime(4465):     @ java.lang.reflect.method.invokenative(native method) 08-09 21:44:06.140: e/androidruntime(4465):     @ java.lang.reflect.method.invoke(method.java:507) 08-09 21:44:06.140: e/androidruntime(4465):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) 08-09 21:44:06.140: e/androidruntime(4465):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) 08-09 21:44:06.140: e/androidruntime(4465):     @ dalvik.system.nativestart.main(native method) 08-09 21:44:06.140: e/androidruntime(4465): caused by: java.lang.runtimeexception: systemservicecreator must implement systemservice 08-09 21:44:06.140: e/androidruntime(4465):     @ org.holoeverywhere.systemservicemanager.register(unknown source) 08-09 21:44:06.140: e/androidruntime(4465):     @ org.holoeverywhere.app.application.<clinit>(unknown source) 08-09 21:44:06.140: e/androidruntime(4465):     ... 16 more 

my proguard.txt file:

-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*  -keep public class * extends android.app.activity -keep public class * extends android.app.application -keep public class * extends android.app.service -keep public class * extends android.content.broadcastreceiver -keep public class * extends android.content.contentprovider -keep public class * extends android.app.backup.backupagenthelper -keep public class * extends android.preference.preference -keep public class com.android.vending.licensing.ilicensingservice  -keepclasseswithmembernames class * {    native <methods>; }  -keepclasseswithmembers class * {    public <init>(android.content.context, android.util.attributeset); }  -keepclasseswithmembers class * {    public <init>(android.content.context, android.util.attributeset, int); }  -keepclassmembers class * extends android.app.activity {   public void *(android.view.view); }  -keepclassmembers enum * {    public static **[] values();    public static ** valueof(java.lang.string); }  -keep class * implements android.os.parcelable {  public static final android.os.parcelable$creator *; }  -keepattributes signature   -keep class sun.misc.unsafe { *; }  -keep class org.springframework.** { *; } -keep class org.codehaus.jackson.** { *; } -keep class org.holoeverywhere.** { *; } -keep class com.actionbarsherlock.** { *; } -keep class com.facebook.** { *; }  -dontwarn org.springframework.** -dontwarn org.apache.**  -libraryjars libs/commons-collections-3.2.1.jar -libraryjars libs/congregando-message-1.0.0-snapshot.jar -libraryjars libs/gson-2.2.3.jar -libraryjars libs/spring-android-auth-1.0.1.release.jar -libraryjars libs/spring-android-core-1.0.1.release.jar -libraryjars libs/spring-android-rest-template-1.0.1.release.jar 

if disable obfuscation, application runs fine. tell me going on?

the error in systemservicemanager.java of holoeverywhere. if read code you'll noticed intentionally throwing error going wrong annotations

public static void register(class<? extends systemservicecreator<?>> clazz) {     if (!clazz.isannotationpresent(systemservice.class)) {         throw new runtimeexception(                 "systemservicecreator must implement systemservice");     }     systemservice systemservice = clazz.getannotation(systemservice.class);     final string name = systemservice.value();     if (name == null || name.length() == 0) {         throw new runtimeexception("systemservice has incorrect name");     }     map.put(name, clazz); } 

a check of proguard troubleshooting document shows default removes annotations unless add this

-keepattributes *annotation* 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -