2015-07-12 40 views
1

我對着試圖建立我使用過Android StudioAndroid Studio錯誤:類android.support.v4.hardware.display.DisplayManagerCompat已被添加到輸出。請刪除重複的副本

Error:Class android.support.v4.hardware.display.DisplayManagerCompat has already been added to output. Please remove duplicate copies. 

我嘗試了不同的建議,這裏在計算器上,例如不包括像下面的包,但它仍然是相同的Android項目時,以下情況除外:

dependencies { 
    dependencies { 
     //compile project(':android-beacon-library') 
     compile 'org.altbeacon:android-beacon-library:[email protected]' 
     compile 'com.squareup.okhttp:okhttp:2.1.0' 
     compile ('com.squareup.picasso:picasso:2.2.0') { 
      exclude group: 'android.support', module: 'library' 
     } 
     compile 'com.google.code.gson:gson:2.2.4' 
     compile('com.github.Comcast:FreeFlow:v-0.6') { 
      exclude group: 'android.support', module: 'library' 
     } 
    } 
} 

使用gradlew.bat命令我試圖找到重複的條目,但該命令的輸出它不存在,粘貼下面是gradlew.bat :app:dependencies輸出:

------------------------------------------------------------ 
Project :app 
------------------------------------------------------------ 

_debugApk - ## Internal use, do not manually configure ## 
+--- org.altbeacon:android-beacon-library:2+ -> 2.3.3 
+--- com.squareup.okhttp:okhttp:2.1.0 
| \--- com.squareup.okio:okio:1.0.1 
+--- com.squareup.picasso:picasso:2.2.0 
+--- com.google.code.gson:gson:2.2.4 
\--- com.github.Comcast:FreeFlow:v-0.6 
    \--- com.android.support:support-v4:22.1.0 
      \--- com.android.support:support-annotations:22.1.0 

_debugCompile - ## Internal use, do not manually configure ## 
+--- org.altbeacon:android-beacon-library:2+ -> 2.3.3 
+--- com.squareup.okhttp:okhttp:2.1.0 
| \--- com.squareup.okio:okio:1.0.1 
+--- com.squareup.picasso:picasso:2.2.0 
+--- com.google.code.gson:gson:2.2.4 
\--- com.github.Comcast:FreeFlow:v-0.6 
    \--- com.android.support:support-v4:22.1.0 
      \--- com.android.support:support-annotations:22.1.0 

_debugTestApk - ## Internal use, do not manually configure ## 
No dependencies 

_debugTestCompile - ## Internal use, do not manually configure ## 
No dependencies 

_releaseApk - ## Internal use, do not manually configure ## 
+--- org.altbeacon:android-beacon-library:2+ -> 2.3.3 
+--- com.squareup.okhttp:okhttp:2.1.0 
| \--- com.squareup.okio:okio:1.0.1 
+--- com.squareup.picasso:picasso:2.2.0 
+--- com.google.code.gson:gson:2.2.4 
\--- com.github.Comcast:FreeFlow:v-0.6 
    \--- com.android.support:support-v4:22.1.0 
      \--- com.android.support:support-annotations:22.1.0 

_releaseCompile - ## Internal use, do not manually configure ## 
+--- org.altbeacon:android-beacon-library:2+ -> 2.3.3 
+--- com.squareup.okhttp:okhttp:2.1.0 
| \--- com.squareup.okio:okio:1.0.1 
+--- com.squareup.picasso:picasso:2.2.0 
+--- com.google.code.gson:gson:2.2.4 
\--- com.github.Comcast:FreeFlow:v-0.6 
    \--- com.android.support:support-v4:22.1.0 
      \--- com.android.support:support-annotations:22.1.0 

androidJacocoAgent - The Jacoco agent to use to get coverage data. 
\--- org.jacoco:org.jacoco.agent:0.7.1.201405082137 

androidJacocoAnt - The Jacoco ant tasks to use to get execute Gradle tasks. 
\--- org.jacoco:org.jacoco.ant:0.7.1.201405082137 
    +--- org.jacoco:org.jacoco.core:0.7.1.201405082137 
    | \--- org.ow2.asm:asm-debug-all:5.0.1 
    +--- org.jacoco:org.jacoco.report:0.7.1.201405082137 
    | +--- org.jacoco:org.jacoco.core:0.7.1.201405082137 (*) 
    | \--- org.ow2.asm:asm-debug-all:5.0.1 
    \--- org.jacoco:org.jacoco.agent:0.7.1.201405082137 

androidTestApk - Classpath packaged with the compiled 'androidTest' classes. 
No dependencies 

androidTestCompile - Classpath for compiling the androidTest sources. 
No dependencies 

androidTestProvided - Classpath for only compiling the androidTest sources. 
No dependencies 

androidTestWearApp - Link to a wear app to embed for object 'androidTest'. 
No dependencies 

apk - Classpath packaged with the compiled 'main' classes. 
No dependencies 

archives - Configuration for archive artifacts. 
No dependencies 

compile - Classpath for compiling the main sources. 
+--- org.altbeacon:android-beacon-library:2+ -> 2.3.3 
+--- com.squareup.okhttp:okhttp:2.1.0 
| \--- com.squareup.okio:okio:1.0.1 
+--- com.squareup.picasso:picasso:2.2.0 
+--- com.google.code.gson:gson:2.2.4 
\--- com.github.Comcast:FreeFlow:v-0.6 
    \--- com.android.support:support-v4:22.1.0 
      \--- com.android.support:support-annotations:22.1.0 

debugApk - Classpath packaged with the compiled 'debug' classes. 
No dependencies 

debugCompile - Classpath for compiling the debug sources. 
No dependencies 

debugProvided - Classpath for only compiling the debug sources. 
No dependencies 

debugWearApp - Link to a wear app to embed for object 'debug'. 
No dependencies 

default - Configuration for default artifacts. 
No dependencies 

provided - Classpath for only compiling the main sources. 
No dependencies 

releaseApk - Classpath packaged with the compiled 'release' classes. 
No dependencies 

releaseCompile - Classpath for compiling the release sources. 
No dependencies 

releaseProvided - Classpath for only compiling the release sources. 
No dependencies 

releaseWearApp - Link to a wear app to embed for object 'release'. 
No dependencies 

wearApp - Link to a wear app to embed for object 'main'. 
No dependencies 

BUILD SUCCESSFUL 

Total time: 9.674 secs 
+0

使用--info或--debug選項運行Gradle查找原因。這通常發生在兩個不同目錄(即主要源代碼中,以及測試源代碼/測試IT源代碼等中)相同的文件名時。我還發現,如果您生成的項目中沒有.java文件,但您在運行中創建了它們(例如:在JIBX/XSL等操作期間創建的).class文件,則可能發生這種情況。 –

回答

0

餵你添加到你的gradle文件。它爲我工作得很好。希望它能幫助你! :)

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

Nope沒有工作,仍然是相同的問題:/ – Waqas

+0

添加此代碼之前依賴關係:配置{所有* .exclude組:'com.android.support.v4',模塊:'support-v4'}並讓我知道它是否工作。 –

相關問題