2016-04-02 3 views
0

私はアンドロイドスタジオにプロジェクトをインポートします。それはコンパイルに関してエラーを起こす。私は修正を試してみたい:How to add Apache HTTP API (legacy) as compile-time dependency to build.grade for Android M?しかし、それは動作していません。私を助けてください!私はアンドロイドスタジオにeclipseをインポートするとエラーを修正するには?(ビルド時のコンパイル時の依存関係として)

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/annotation/GuardedBy.class 

ファイルbuild.gradle:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 
    useLibrary 'org.apache.http.legacy' 

    defaultConfig { 
     applicationId "vae.vnsupermark.com" 
     minSdkVersion 14 
     targetSdkVersion 23 
     multiDexEnabled = true 
//  versionCode 1 
//  versionName "1.0" 
     ndk { 
      moduleName "vnsm" 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 
dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:multidex:1.0.1' 


    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.google.code.gson:gson:2.2.4' 
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' 
    // compile 'com.android.support:appcompat-v7:20.0.0' 
// compile 'com.google.android.gms:play-services:+' 
    compile 'com.google.android.gms:play-services:4.0.30' 
    compile files('libs/activation.jar') 
    compile files('libs/additionnal.jar') 
    compile files('libs/commons-io-2.4.jar') 
    compile files('libs/error-reporter.jar') 
    //compile files('libs/httpclient-4.0.1.jar') 
    compile files('libs/mail.jar') 
    compile files('libs/universal-image-loader-1.9.3.jar') 
} 
+0

期待どおりこの変更の後、

//compile files('libs/httpclient-4.0.1.jar') 

をコメントアウトすると、実際に動作します: 'LIBS' を含む:fileTree(DIRをコンパイルし、 '[ '*を.jar ']) ' – helleye

+0

本当にありがとう!それは働いている! –

答えて

0

それはまだライブラリのコンパイル(とのlibsフォルダ内の他のすべてのjarファイル)しますので、あなたは明らかにそれがあるとして、

compile fileTree(dir: 'libs', include: ['*.jar']) 

を削除する必要がありますlibsフォルダから削除されません。 あなたは私はあなたがこの行をコメント/削除するべきだと思います:)

関連する問題