2016-09-18 12 views
1

私はアプリをテストするために私のsamsung A5を使用しています。プロジェクトは私の電話機で正しく動作していますが、他の電話機では動作しません。だから私はGenerate signed APK私のプロジェクトからしたい。署名されたAPKエラーを生成します。java.util.zip.ZipException

Error:Execution failed for task '::transformClassesWithDexForRelease'. 
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/daimajia/androidanimations/library/BaseViewAnimator; 

私はエラーをGoogleで検索し、これらのコードは、そのエラー取り除く:

multiDexEnabled true 

packagingOptions { 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/license.txt' 
    exclude 'META-INF/notice.txt' 
} 

を今、別の例外がある:

が、例外エラーが発生しました
Error:Execution failed for task ':transformClassesWithJarMergingForRelease'. 
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/daimajia/androidanimations/library/BaseViewAnimator.class 

だと思います彼は私が使っているライブラリのせいかもしれませんが、それをどう扱うか分かりません。以下build.gradle内のすべてのライブラリです:

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 

    //for compiling card view 
    compile 'com.android.support:cardview-v7:23.0.0' 
    compile 'com.android.support:recyclerview-v7:23.0.0' 

    //for sticky header 
    compile 'com.github.carlonzo.stikkyheader:core:0.0.3-SNAPSHOT' 
    compile 'com.github.ksoichiro:android-observablescrollview:1.5.0' 
    compile 'com.nineoldandroids:library:2.4.0' 
    compile 'com.melnykov:floatingactionbutton:1.0.7' 

    compile 'com.ogaclejapan.smarttablayout:library:[email protected]' 

    compile 'com.ogaclejapan.smarttablayout:utils-v4:[email protected]' 

    compile 'me.drakeet.materialdialog:library:1.3.1' 

    compile files('libs/volley.jar') 

    compile 'com.daimajia.easing:library:[email protected]' 

    compile 'com.daimajia.androidanimations:library:[email protected]' 

    //Sweet Alert Dialog 
    compile 'cn.pedant.sweetalert:library:1.3' 

    compile 'org.apmem.tools:layouts:[email protected]' 

} 

答えて

2

いくつかのこと...

まず第一に、私はあなたが含めているサードパーティのライブラリの大部分を除去したいです。例えば、

//for sticky header 
compile 'com.github.carlonzo.stikkyheader:core:0.0.3-SNAPSHOT' 
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0' 
compile 'com.nineoldandroids:library:2.4.0' 
compile 'com.melnykov:floatingactionbutton:1.0.7' 

それらのすべて

compile 'com.android.volley:volley:1.0.0'

に置き換える必要がありますが、また

compile 'com.ogaclejapan.smarttablayout:library:[email protected]' 
compile 'com.ogaclejapan.smarttablayout:utils-v4:[email protected]' 

compile files('libs/volley.jar')を削除することができ、私が思う名からGoogleの

からDesign Support Libraryで覆われていますまた削除します

//Sweet Alert Dialog 
compile 'cn.pedant.sweetalert:library:1.3' 

compile 'org.apmem.tools:layouts:[email protected]' 

あなたが含むプロジェクトの多くは、2年以上で働いていません。 Googleのサポートライブラリを使用してください。これはデザインサポートライブラリから大部分を得られます。

最後の点。アプリがこれらのライブラリをすべて含んでおり、64k method limitを渡しているため、Dexエラーが発生しています。私はproguardを使用して未使用のコードを削除し、プロジェクトのメソッド数を減らすことをお勧めします。

関連する問題