2016-09-28 41 views
0

你好我面對這個錯誤例外:重複的條目:安卓/支持/ V7 /空間/ CardViewApi21.class

Error:Execution failed for task transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/widget/CardViewApi21.class 

我是刪除重複的依賴,庫。

gradle這個

apply plugin: 'com.android.application' 

dependencies { 
compile fileTree(dir: 'libs', include: '*.jar') 
//compile 'com.android.support:cardview-v7:21.0.3' 
compile ('com.android.support:cardview-v7:21.0.3') { 
    exclude module: 'support-v4' 
} 
compile project(':FacebookSDK') 
compile 'com.android.support:multidex:1.0.1' 

compile project(':google-play-services_lib') 
//compile files('libs/cardview-v7-21.0.0.jar') 
} 

android { 
compileSdkVersion 16 
buildToolsVersion "23.0.2" 
repositories { 
    mavenCentral() 
} 
signingConfigs { 
    release { 
     storeFile file("demo.jks") 
     storePassword "demo" 
     keyAlias "demo" 
     keyPassword "demo" 
    } 
} 

dexOptions { 
    //incremental = true; 
    preDexLibraries = false 
    javaMaxHeapSize "4g" 
} 

buildTypes { 
    release { 
     minifyEnabled true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     signingConfig signingConfigs.release 
     lintOptions { 
      disable 'MissingTranslation' 
     } 
    } 
} 
lintOptions { 
    abortOnError false 
    checkReleaseBuilds false 
} 
packagingOptions { 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/license.txt' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/notice.txt' 
    exclude 'META-INF/ASL2.0' 
} 

defaultConfig { 
    multiDexEnabled true 
} 

sourceSets { 
    main { 
     manifest.srcFile 'AndroidManifest.xml' 
     java.srcDirs = ['src'] 
     resources.srcDirs = ['src'] 
     aidl.srcDirs = ['src'] 
     renderscript.srcDirs = ['src'] 
     res.srcDirs = ['res'] 
     assets.srcDirs = ['assets'] 
    } 

    // Move the tests to tests/java, tests/res, etc... 
    instrumentTest.setRoot('tests') 

    // Move the build types to build-types/<type> 
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
    // This moves them out of them default location under src/<type>/... which would 
    // conflict with src/ being used by the main source set. 
    // Adding new build types or product flavors should be accompanied 
    // by a similar customization. 
    debug.setRoot('build-types/debug') 
    release.setRoot('build-types/release') 
    } 
    } 
apply plugin: 'announce' 
+0

添加'build.gradle'文件。它的依賴問題部分 – piotrek1543

+0

你可以發佈你的'build.gradle'嗎? – raxelsson

+0

嗨任何關於想法? –

回答

0

嘗試編譯您cardview像

compile ('com.android.support:cardview-v7:24.1.1') { 
exclude module: 'support-v4' 
    } 
+0

不,沒有解決 –

+0

發佈你的gradle?/ –

+0

plz檢查我發佈在ans –

0

從lib文件夾中刪除未使用的罐子。 清理項目並嘗試重新編譯。

還設置compileToolVersion至23

0

看來,有一個叫cardview-v7-21.0.0.jar一個jar文件。

有評論

//compile files('libs/cardview-v7-21.0.0.jar'). 

,但使用該行

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

你只是包括相同的jar文件。

應從您的libs文件夾中刪除cardview-v7-21.0.0.jar文件。

相關問題