Ale*_*hun 43 android compiler-errors
美好的一天.在AndroidStudio中更新谷歌存储库后,我遇到了问题
> 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
Run Code Online (Sandbox Code Playgroud)
我试图从播放服务中排除组android.support,它没有帮助.当我在另一台PC上开始我的项目时,我有:
> Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry:
> android/support/annotation/AnimRes.class
Run Code Online (Sandbox Code Playgroud)
我的build.gradle:
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'
}
Run Code Online (Sandbox Code Playgroud)
Ale*_*hun 71
在终端执行根项目文件夹中:
./gradlew clean
Run Code Online (Sandbox Code Playgroud)
它帮助了我.
Ran*_*mar 15
以上所有都不适合我..因为我使用Facebook广告依赖..
如果有人使用这种依赖 编译'com.facebook.android:audience-network-sdk:4.16.0'
试试这个代码,而不是上面
compile ('com.facebook.android:audience-network-sdk:4.16.0'){
exclude group: 'com.google.android.gms'
}
Run Code Online (Sandbox Code Playgroud)
小智 9
打开系统命令提示符/终端 - >转到项目文件夹路径(根项目文件夹) - >执行以下命令:command: - 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'
Run Code Online (Sandbox Code Playgroud)
- >重建你的项目,它会正常工作.
在终端中使用项目根目录如下: - /Users/rajnish/Desktop/RankProjects/ProjectCloud
之后输入此命令./gradlew clean
它会工作.
报告问题可能有不同的原因,在升级工作室之后,几天前也面临这个问题'重复jar'.从所有stackoverflow我尝试了所有的建议,但没有任何对我有用.
但这肯定是有一些重复的jar,对我来说它存在于一个库libs文件夹以及项目libs文件夹中.所以我从项目libs文件夹中删除了,因为这里不需要它.因此在更新工作室时要小心,并尝试了解所有的gradle错误.
| 归档时间: |
|
| 查看次数: |
115150 次 |
| 最近记录: |