我在Gradle构建过程中遇到以下错误:
错误:任务执行失败> ':应用程序:transformClassesWithJarMergingForDebug'。
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目: 机器人/支撑/ V4 /插件/ ExploreByTouchHelper.class
我还检查了依赖项:
release
+--- com.android.support:multidex:1.0.1
+--- com.google.android.gms:play-services:8.4.0
| +--- com.google.android.gms:play-services-ads:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-analytics:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-appindexing:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-appinvite:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-appstate:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-auth:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-cast:8.4.0
| | +--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.android.support:mediarouter-v7:23.0.0
| | +--- LOCAL: internal_impl-23.0.0.jar
| | \--- com.android.support:appcompat-v7:23.2.1
| | +--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | +--- com.android.support:animated-vector-drawable:23.2.1
| | | \--- com.android.support:support-vector-drawable:23.2.1
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.android.support:support-vector-drawable:23.2.1
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-drive:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-fitness:8.4.0
| | +--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.google.android.gms:play-services-location:8.4.0
| | +--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.google.android.gms:play-services-maps:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-games:8.4.0
| | +--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.google.android.gms:play-services-drive:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-gcm:8.4.0
| | +--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.google.android.gms:play-services-measurement:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-identity:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-location:8.4.0
| | +--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.google.android.gms:play-services-maps:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-maps:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-measurement:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-nearby:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-panorama:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-plus:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-safetynet:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-vision:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.google.android.gms:play-services-wallet:8.4.0
| | +--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | +--- com.google.android.gms:play-services-identity:8.4.0
| | | \--- com.google.android.gms:play-services-base:8.4.0
| | | \--- com.google.android.gms:play-services-basement:8.4.0
| | | \--- com.android.support:support-v4:23.2.1
| | | \--- LOCAL: internal_impl-23.2.1.jar
| | \--- com.google.android.gms:play-services-maps:8.4.0
| | \--- com.google.android.gms:play-services-base:8.4.0
| | \--- com.google.android.gms:play-services-basement:8.4.0
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| \--- com.google.android.gms:play-services-wearable:8.4.0
| \--- com.google.android.gms:play-services-base:8.4.0
| \--- com.google.android.gms:play-services-basement:8.4.0
| \--- com.android.support:support-v4:23.2.1
| \--- LOCAL: internal_impl-23.2.1.jar
+--- com.android.support:appcompat-v7:23.2.1
| +--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| +--- com.android.support:animated-vector-drawable:23.2.1
| | \--- com.android.support:support-vector-drawable:23.2.1
| | \--- com.android.support:support-v4:23.2.1
| | \--- LOCAL: internal_impl-23.2.1.jar
| \--- com.android.support:support-vector-drawable:23.2.1
| \--- com.android.support:support-v4:23.2.1
| \--- LOCAL: internal_impl-23.2.1.jar
+--- com.mcxiaoke.volley:library-aar:1.0.0
+--- com.android.support:recyclerview-v7:24.2.0
| +--- com.android.support:support-compat:24.2.0
| | \--- LOCAL: internal_impl-24.2.0.jar
| \--- com.android.support:support-core-ui:24.2.0
| +--- LOCAL: internal_impl-24.2.0.jar
| \--- com.android.support:support-compat:24.2.0
| \--- LOCAL: internal_impl-24.2.0.jar
\--- com.android.support:cardview-v7:24.2.0
答案 0 :(得分:4)
我能够通过将最新版本的appcompat和recyclerview用于我的compileSdkVersion来解决此问题。
由于我的compileSdkVersion设置为23,因此我将gradle依赖项更改为:
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
我注意到你有不匹配的appcompat和recyclerview版本。其中一个与您的compileSdkVersion不匹配。如果打开build.gradle文件,您应该会看到有关此问题的警告。希望这会有所帮助。
答案 1 :(得分:4)
打开系统命令提示符/终端
- >转到项目文件夹路径(根项目文件夹)
- >执行以下命令:
命令: - gradlew clean
或./gradlew clean
确保您的所有gradle依赖项都是相同的版本。 - >示例: - 您的appcompat和recyclerview依赖项应具有相同的版本。
- >将您的gradle依赖项更改为相同的版本,如: -
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
- >重建你的项目,它会正常工作。