2016-12-24 9 views
0

私はAndroidプログラミングの新機能です。

私はこのようなエラー私は自分のアプリケーションをコンパイルしてるんだ:

エラー:実行は、タスクに失敗しました「:アプリ:transformClassesWithJarMergingForDebug」を。私はすでに私のlibフォルダ内のすべての重複をサポート-v4のファイルを削除

apply plugin: 'com.android.application' 


    android { 
     compileSdkVersion 17 
     buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.ecs.google.maps.v2.actionbarsherlock" 
     minSdkVersion 9 
     targetSdkVersion 17 
     // Enabling multidex support. 
     multiDexEnabled true 
    } 

    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

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

} 

configurations { all*.exclude group: 'com.android.support', module: 'support-v4' } 

dependencies { 
    compile 'com.actionbarsherlock:actionbarsherlock:[email protected]' 
    compile ('com.android.support:gridlayout-v7:+') { 
     exclude module: 'support-v4' 
    } 

    compile 'com.astuetz:pagerslidingtabstrip:1.0.0' 
    compile ('com.google.maps.android:android-maps-utils:0.3+') { 
     exclude module: 'support-v4' 
    } 

    compile 'com.google.code.gson:gson:2.1' 
    compile ('com.google.android.gms:play-services-maps:8.4.0') { 
     exclude module: 'support-v4' 
    } 



    compile files('libs/google-http-client-1.15.0-rc.jar') 
    compile files('libs/google-http-client-android-1.15.0-rc.jar') 
    compile files('libs/google-http-client-jackson2-1.15.0-rc.jar') 
    compile files('libs/httpclient-4.0.1.jar') 
    compile files('libs/httpcore-4.0.1.jar') 
    compile files('libs/jackson-core-2.1.3.jar') 
    compile files('libs/jackson-core-asl-1.9.11.jar') 


} 

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/view/ViewPager$MyAccessibilityDelegate.class

が、これは私のGradleファイルです。

私のコードで何が間違っているのか分かりますか?ご協力いただきありがとうございます。モジュール名は異なる可能性があるため、スクリプトの下

答えて

1

は常にサポート-V4

compile ('some-module') { 
    exclude module: 'support-v4' 
} 

を除外しません。 そのため、適切なモジュール名を除外するために、最初にモジュール名(ARTIFACT_ID)を見つける必要があります。エラーの下に発生する私のプロジェクトの依存関係としてRecyclerViewを追加私の場合は

、。

duplicate entry: android/support/v4/view/ViewPager$MyAccessibilityDelegate.class

duplicate entry: android/support/v4/hardware/display/DisplayManagerCompat.class

私はGradleのタスクandroidDependenciesを使用してモジュールを見つけました。このタスクを実行する

enter image description here

依存関係ツリー(以下参照画像)が表示されます。

enter image description here

は、不要な又は重複するモジュールを除去しました。

compile ('com.android.support:recyclerview-v7:+') { 
    exclude module: "support-core-ui" 
    exclude module: "support-compat" 
} 
+0

これはうまくいきます、おい、ありがとう...あなたは私の一日を救った! –