2014-01-10 44 views
0

我想爲我的android應用使用ProGuard,但是我遇到了一些麻煩。當我建立使用Android工具的APK未經(在Eclipse)我有以下錯誤:爲多個罐子的android-eclipse項目配置ProGuard

Warning: com.millennialmedia.android.NVASpeechKit$7: can't find referenced class com.nuance.nmdp.speechkit.Recognizer 
[...] //more warnings of the same type as above 
You should check if you need to specify additional program jars. 
Warning: there were 170 unresolved references to classes or interfaces. 
You may need to specify additional library jars (using '-libraryjars'). 
java.io.IOException: Please correct the above warnings first. 
at proguard.Initializer.execute(Initializer.java:321) 
at proguard.ProGuard.initialize(ProGuard.java:211) 
at proguard.ProGuard.execute(ProGuard.java:86) 
at proguard.ProGuard.main(ProGuard.java:492) 

我用我的應用程序內的5個jar文件,它們都位於庫文件夾,並添加到build-path(所以它們可以顯示在'Referenced Libraries'以及'Android Private Libraries'中)。另外,我把一個庫文件放在libs/armeabi中...

My proguard - file look pretty normal, yet: 
-optimizationpasses 5 
-dontusemixedcaseclassnames 
-dontpreverify 
-dontskipnonpubliclibraryclasses 
-verbose 
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* 
-assumenosideeffects class android.util.Log { 
    public static *** d(...); 
    public static *** e(...); 
} 

我該怎麼辦才能解決這個錯誤?

問候

PS:我知道,proguard的可以刪除/修改一些重要的事情(如類文件,..)。那麼,在啓動我的應用程序時,我會立即注意到異常會出現這樣的「錯誤」嗎?還是必須在運行時檢查每個細節並導航到我的應用程序的任何部分,以確保其運行正常?

編輯: 我用下面的罐子我:

alljoyn.jar(有也是在鏈接資源的alljoyn-SDK的路徑varibale)

peergroupmanager.jar

Android的支持-v4.jar

MMSDK.jar

GoogleAdMobAdsSdk-6.4.1.jar

+0

你能確認你正在使用Android SDK的ProGuard配置文件作爲您的項目說明?屬性文件> proguard.config = $ {sdk.dir} /tools/proguard/proguard-android.txt:proguard-project.txt。根據以往的經驗,您可能需要爲某些第三方庫添加一些自定義排除項,您能列出它們嗎? – scottyab

+0

這是在我的project.properties proguard.config = C:/Android SDK/tools/proguard/proguard-android.txt:proguard-project.txt 我編輯了問題,因爲libs – user2224350

回答

2

http://docs.millennialmedia.com/android-SDK/AndroidFAQ.html

我在我的Android應用程序中使用ProGuard,我應該怎麼做才能確保我的千禧年廣告仍然有效?

要確保您在使用ProGuard時仍能收到廣告,請將以下代碼段添加到您的proguard.cfg文件中。

-keepclassmembers class com.millennialmedia.android.* { 
public *; 
} 
-keep class com.millennialmedia.android.** 

當使用ProGuard,而不是SpeechKit,以下行添加到他們的ProGuard-project.txt:

-dontwarn com.millennialmedia.android.NVASpeechKit* 
+0

請提出另一個問題。 – scottyab