2011-11-10 4 views
12

どのように警告に対処できますか?Proguardは私に、「上記の警告を最初に訂正してください。外部ジャーの参照を扱うにはどうすればいいですか?

ログインはこちら

[proguard] Note: duplicate definition of library class... 
... 
[proguard] Note: there were 370 duplicate class definitions. 
[proguard] Initializing... 
[proguard] Warning: abc.cba..: can't find superclass or interface xyz.zyx.... 
... 
[proguard] Note: the configuration refers to the unknown class 'android.app.backup.BackupAgentHelper'... 
... 
[proguard] Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer... 
... 

proguard.cfg

-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 
-keep public class !testAppH23.** { *; } 

-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 *; 
} 

言うが AndroidのAntはProGuardの有効コンソールログを有効にして構築しています。ここでは、リンク ant build console log

が私のbuild.xml(基本的にはそのアンドロイド元アリスクリプト)でご覧ください。リンクを参照してください TestAppH23 Android Ant Build With Proguard Enabled

local.properties

sdk.dir=C:\\androiddev\\android-sdk-windows 

build.properties

proguard.config=proguard.cfg 
key.store=testapph23-release.keystore 
key.alias=alisname 
key.store.password=storepassword 
key.alias.password=aliaspassword 

default.properties

target=android-7 

私は長い投稿のために謝罪します。正しい方向へのガイダンスは高く評価されます。

UPDATES1 のAndroidManifest.xmlあなたが入力jarファイル内のいくつかの不審な構築物はOKですProGuardのを安心させる必要があり

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="testAppH23.activity" 
     android:versionCode="1" 
     android:versionName="1.0"> 
    <application 
     android:icon="@drawable/home" 
     android:theme="@android:style/Theme.NoTitleBar" 
     android:label="@string/app_name" 
     > 
     <activity 
      android:name=".start.StartActivity" 
      android:label="@string/app_name" 
      android:theme="@style/Theme.Translucent" 
      android:screenOrientation="portrait" 
      android:launchMode="singleTask" 
      > 
      <intent-filter> 
       <action 
        android:name="android.intent.action.MAIN" 
        > 
       </action> 
       <category 
        android:name="android.intent.category.LAUNCHER" 
        > 
       </category> 
      </intent-filter> 
     </activity> 
     ..... 
     <service android:name="com.abc.myjar.papi.PIntentService"></service> 

     <service android:name=".service.XyzService"></service> 

    </application> 


    <uses-library android:name="org.apache.http.entity"/> 
    <uses-library android:name="org.apache.http.james.mime4j"/> 

    <uses-permission android:name="android.permission...."/> 

    <uses-sdk android:minSdkVersion="7" /> 

</manifest> 

答えて

21

あなたのプログラムコードには、パッケージorg.xmlpull.v1にAndroidランタイムクラスのコピーまたはそれ以上のバージョンが含まれています。それは大丈夫です:

-dontwarn org.xmlpull.v1.** 
-dontnote org.xmlpull.v1.** 

あなたのプログラムコードには、org.apache.httpにAndroidランタイムクラスのコピーが含まれています。それは大丈夫です:

-dontnote org.apache.http.** 

あなたのプログラムコードは、Androidには存在しないAWTを参照しています。それは大丈夫です:

-dontwarn java.awt.** 

あなたのPostgreSQLドライバは、Androidには存在しない多くのjavaxクラスを指します。それは大丈夫だ場合:

-dontwarn org.postgresql.** 

のように...

Cfrの。ProGuardのマニュアルは>

Troubleshootingは最後に、あなたの構成がtestAppH23のものを除き、すべてのpublicクラスを保持し、その公開/ /保護されたプライベートクラスメンバーは、縮小されることから/最適化/難読化され、-keep public class !testAppH23.** { *;}を指定します。これにより、ディスクリプタクラスに関するいくつかの(無害な)メモが発生する可能性があります。一貫性を保つために、クラスの「public」を削除するか、クラスメンバの「public protected」を追加することができます。

+1

私の場合、Dropbox jarsとGoogleドライブjarsを追加したとき、それは単に-dontwarn org.apache。**と-dontwarn com.google.android.gms。**(proguard-google- api-client.txtはGoogle Eclipseプラグインによって自動的に追加されました)。 -dontnoteステートメントを追加する必要はありませんでした。たぶん、すべての警告が消え去ってしまったので、問題を「メモ」する理由はなかったでしょう。あなたの投稿に感謝します。 – petrsyn

関連する問題