2013-05-04 36 views
0

我的應用程序已測試並正常工作。但是當我嘗試測試釋放apk時,它崩潰了。我包括我的proguard文件和測試釋放apk時獲得的錯誤日誌。基本上它通過意圖拍攝照片後崩潰,然後嘗試通過互聯網將照片發送給收件人。再次,我的應用程序工作正常:直到proguard進入混合。嘗試使用相機發送圖片時Proguard崩潰應用程序

甲注:

發送所述圖像的代碼是由一Thread開始作爲在new Thread(runnable).start()一個Runnable;非常基本的東西。再次,代碼在proguard之外工作。

project.properties文件是使用默認的Android文件和​​我的。

機器人的ProGuard:

# This is a configuration file for ProGuard. 
# http://proguard.sourceforge.net/index.html#manual/usage.html 

-dontusemixedcaseclassnames 
-dontskipnonpubliclibraryclasses 
-verbose 

# Optimization is turned off by default. Dex does not like code run 
# through the ProGuard optimize and preverify steps (and performs some 
# of these optimizations on its own). 
-dontoptimize 
-dontpreverify 
# Note that if you want to enable optimization, you cannot just 
# include optimization flags in your own project configuration file; 
# instead you will need to point to the 
# "proguard-android-optimize.txt" file instead of this one from your 
# project.properties file. 

-keepattributes *Annotation* 
-keep public class com.google.vending.licensing.ILicensingService 
-keep public class com.android.vending.licensing.ILicensingService 

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native 
-keepclasseswithmembernames class * { 
    native <methods>; 
} 

# keep setters in Views so that animations can still work. 
# see http://proguard.sourceforge.net/manual/examples.html#beans 
-keepclassmembers public class * extends android.view.View { 
    void set*(***); 
    *** get*(); 
} 

# We want to keep methods in Activity that could be used in the XML attribute onClick 
-keepclassmembers class * extends android.app.Activity { 
    public void *(android.view.View); 
} 

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations 
-keepclassmembers enum * { 
    public static **[] values(); 
    public static ** valueOf(java.lang.String); 
} 

-keep class * implements android.os.Parcelable { 
    public static final android.os.Parcelable$Creator *; 
} 

-keepclassmembers class **.R$* { 
    public static <fields>; 
} 

# The support library contains references to newer platform versions. 
# Don't warn about those in case this app is linking against an older 
# platform version. We know about them, and they are safe. 
-dontwarn android.support.** 

項目的ProGuard:

# My addition 

-keepclassmembers class com.mycompany.mygame.** { 
    public static <fields>; 
} 

# -keep public class com.mycompany.mygame.** { *; } 
-dontwarn com.mycompany.mygame.** 

# -keep public class android.support.** { *; } 
-dontwarn android.support.** 

# -keep public class com.google.android.gms.** { *; } 
-dontwarn com.google.android.gms.** 

# -keep public class com.google.common.** { *; } 
-dontwarn com.google.common.** 

# -keep public class org.apache.commons.** { *; } 
-dontwarn org.apache.commons.** 

# -keep public class org.apache.http.impl.** { *; } 
-dontwarn org.apache.http.impl.** 

# -keep public class android.net.http.AndroidHttpClient { *; } 
-dontwarn android.net.http.AndroidHttpClient 

錯誤日誌:

05-03 17:40:45.704: E/CameraApp(5068): [SoundController.java:468:onDestroy()] onDestroy-end, sound_pool release 2/2 
05-03 17:40:52.829: E/AndroidRuntime(5327): FATAL EXCEPTION: Thread-514 
05-03 17:40:52.829: E/AndroidRuntime(5327): xb: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'xc'. Please check the custom implementation. Help can be found @http://commons.apache.org/logging/troubleshooting.html.) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at xc.a(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at xe.run(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at java.security.AccessController.doPrivileged(AccessController.java:45) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at xc.a(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at xc.a(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at xc.b(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at afj.<init>(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at afr.<init>(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at gu.a(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at ha.a(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at ha.run(Unknown Source) 
05-03 17:40:52.829: E/AndroidRuntime(5327):  at java.lang.Thread.run(Thread.java:856) 
05-03 17:40:52.829: E/AndroidRuntime(5327): Caused by: java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'xc'. Please check the custom implementation. Help can be found @http://commons.apache.org/logging/troubleshooting.html. 
05-03 17:40:52.829: E/AndroidRuntime(5327):  ... 12 more 
05-03 17:41:13.829: E/Trace(5606): error opening trace file: No such file or directory (2) 
+0

幹得好,包括原木,但你可以修剪它們回到關鍵部分。在這種情況下,請查看日誌中的倒數第三行以獲取非常詳細的錯誤消息。 – 2013-05-04 01:11:21

+0

@EdwardFalk我修剪它。我看到了錯誤。我只是不知道該怎麼告訴proguard來修復它。現在我已經在這個相同的bug上轉了兩天了。我歡迎幫助。 – 2013-05-04 01:19:21

+0

失敗的代碼在我的編輯解釋的'Runnable'內。 – 2013-05-04 01:23:09

回答

2

的警示信號是這一行:

05-03 17:40:52.829: E/AndroidRuntime(5327): Caused by: java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'xc'. Please check the custom implementation. Help can be found @http://commons.apache.org/logging/troubleshooting.html. 

看起來有些Apache的日誌記錄的類已通過Proguard的重命名,並從Proguard的配置文件,你必須

# -keep public class org.apache.commons.** { *; } 

標記爲註釋(以「#」前綴)的,所以我會刪除「#」上面這行代碼告訴Proguard不要重命名包org.apache.commons中的類,然後重試。

+0

我會再試一次。但事實是,我開始與他們所有的人沒有註釋。然後我評論他們,因爲代碼仍然失敗。 – 2013-05-04 04:02:28

+0

你是否從org.apache.commons擴展任何類?如果是這樣,他們也需要被添加到Proguard的配置文件中。 – Kai 2013-05-04 04:34:15

+0

它停止崩潰。非常感謝您的幫助。 +1。 – 2013-05-04 05:15:08

相關問題