Android 错误:任务';的执行失败:应用程序:使用Jarmergingfordebug和x27转换类;
你好。 在AndroidStudio中更新google存储库后,我遇到了一个问题Android 错误:任务';的执行失败:应用程序:使用Jarmergingfordebug和x27转换类;,android,compiler-errors,Android,Compiler Errors,你好。 在AndroidStudio中更新google存储库后,我遇到了一个问题 > Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: > android/support/v7
> Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry:
> android/support/v7/cardview/BuildConfig.class
我正试图将组android.support排除在play服务之外,这没有帮助。
当我在另一台电脑上开始我的项目时,我有:
> Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry:
> android/support/annotation/AnimRes.class
我的身材。格雷德尔:
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ru.alexeyk.myevents"
minSdkVersion 14
targetSdkVersion 23
versionCode 16
versionName "1.121"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.github.nkzawa:socket.io-client:0.4.2') {
exclude group: 'org.json', module: 'json'
}
compile files('libs/sentry-1.1.4.jar')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.github.machinarius:preferencefragment:0.1.2'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.makeramen:roundedimageview:2.1.1'
compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
compile 'com.yandex.android:mobmetricalib:2.00@aar'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
}
在根项目文件夹中的终端执行:
./gradlew clean
它帮助了我。AndroidStudio菜单: 建造/清洁项目
更新旧的依赖项在终端中使用项目根目录如下:-/Users/rajnish/Desktop/RankProjects/ProjectCloud 然后输入此命令。/gradlew clean
它会工作的。我出现这个错误是因为我的build.gradle中没有正确的行。我使用的是
org.apache.http.legacy.jar
库,它需要:
android{
useLibrary 'org.apache.http.legacy'
...
}
所以,请检查您的gradle文件中是否有所需的所有内容。报告问题的原因可能不同,几天前升级studio后,您还将面临“复制jar”问题。尽管我尝试了所有的建议,但都不管用
但这肯定存在一些重复的jar,对我来说,它存在于一个library文件夹和projectlibs文件夹中。所以我从projectlibs文件夹中删除了它,因为这里不需要它。因此,在更新studio时要小心,尽量理解所有gradle错误。打开系统命令提示符/terminal->转到项目文件夹路径(根项目文件夹)->执行以下命令:命令:-
gradlew clean
或/gradlew clean
确保所有gradle依赖项的版本相同。->示例:-您的appcompat和recyclerview依赖项应该具有相同的版本
->将渐变依赖项更改为相同版本,如下所示:-
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'
->重建您的项目,它将正常工作。以上所有内容对我都不起作用。。因为我在使用Facebook广告 如果任何人使用此依赖项编译'com.facebook.android:accounter network sdk:4.16.0' 请尝试此代码而不是上面的代码
compile ('com.facebook.android:audience-network-sdk:4.16.0'){
exclude group: 'com.google.android.gms'
}
我通过双重检查“libs”目录并删除冗余jar解决了这个问题,即使这些jar不是手动添加到依赖项中的 查看他们的重复JAR或依赖项是否会被删除,您的错误将消失: 如:
如果添加android:supportv4 jar和依赖项,您将得到错误,因此删除jar错误将消失我通过将recyleview的版本号更改为recyclerview-v7:24.2.1来解决此问题。
请检查您的依赖项并使用正确的版本号。对于我来说,问题是由
com.google.android.exoplayer
与com.facebook.android:academy network sdk
冲突引起的
我通过将exoplayer
库从观众网络sdk
中排除,解决了这个问题:
compile ('com.facebook.android:audience-network-sdk:4.24.0') {
exclude group: 'com.google.android.exoplayer'
}
@dens14345您使用什么操作系统?@dens14345请尝试。\gredlew.bat clean我尝试了gradlew clean,但它不起作用。我收到了相同的错误。这显然不是解决任何实际问题的办法。这只是重建项目。在我的例子中,我发现google play服务和firebase广告有不同的版本。firebase现在属于google play服务的保护伞下,因此有相同的版本。这对我来说很有效。清理并更改了apps build.gradle.Sir中的
compile'com.android.support:recyclerview-v7:+'
到compile'com.android.support:recyclerview-v7:24.2.1'
,如果您曾经在南美,您刚刚为自己赢得了一杯免费啤酒。感谢你的回答,我开始失去希望:)你的回答是解决我问题的办法