2013-08-10 4 views
1
난독 난독으로, 릴리스 모드에서 내 응용 프로그램을 테스트하는 동안 나는 다음과 같은 오류를 얻고있다

:안드로이드 Holoeverywhere Proguard와 지옥

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):  at java.lang.Class.newInstanceImpl(Native Method) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at java.lang.Class.newInstance(Class.java:1409) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.app.Instrumentation.newApplication(Instrumentation.java:957) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.app.Instrumentation.newApplication(Instrumentation.java:942) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.app.LoadedApk.makeApplication(LoadedApk.java:461) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3264) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.app.ActivityThread.access$2200(ActivityThread.java:117) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.os.Handler.dispatchMessage(Handler.java:99) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.os.Looper.loop(Looper.java:123) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at android.app.ActivityThread.main(ActivityThread.java:3687) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at java.lang.reflect.Method.invokeNative(Native Method) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at java.lang.reflect.Method.invoke(Method.java:507) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at dalvik.system.NativeStart.main(Native Method) 
08-09 21:44:06.140: E/AndroidRuntime(4465): Caused by: java.lang.RuntimeException: SystemServiceCreator must be implement SystemService 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at org.holoeverywhere.SystemServiceManager.register(Unknown Source) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  at org.holoeverywhere.app.Application.<clinit>(Unknown Source) 
08-09 21:44:06.140: E/AndroidRuntime(4465):  ... 16 more 

내 proguard.txt 파일 :

-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 

내가 난독을 사용하지 않으면 , 응용 프로그램이 잘 실행됩니다. 무슨 일이 일어나는지 말해 줄 수 있습니까?

+1

-keepattributes * Annotation *을 추가해보십시오. 주석은 proguard documentation을 참조하십시오. –

+0

대단히 고마워요! 그것은 문제를 해결했다 !! – andresmafra

답변

3

오류는 Holoeverywhere의 SystemServiceManager.java에 있습니다. 코드를 읽으면 당신이 의도적으로 무언가로 오류를 던지고 주석

public static void register(Class<? extends SystemServiceCreator<?>> clazz) { 
    if (!clazz.isAnnotationPresent(SystemService.class)) { 
     throw new RuntimeException(
       "SystemServiceCreator must be 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); 
} 

으로 잘못된 것이라는 것을 알 수 있습니다

proguard troubleshooting document의 검사는 기본적으로 당신이하지 않는 주석이

-keepattributes *Annotation* 
를 추가 제거 보여줍니다