我在生成签名的apk时遇到此错误。即使我尝试了很多解决方案,但没有人适合我。
请帮助我:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout$1.class
我的gradle文件代码是
Build.gradle在这里请告诉我生成签名apk的错误是什么: -
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.google.com' }
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id: "MyKey", onesignal_google_project_number: "REMOTE"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:multidex:1.0.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:27.0.1'
implementation 'com.google.android.gms:play-services:12.0.0'
implementation 'com.android.support:cardview-v7:27.0.1'
implementation 'com.android.support:recyclerview-v7:27.0.1'
compile 'com.android.support:design:27.0.1'
compile 'com.wang.avi:library:2.1.3'
compile 'com.github.rey5137:material:1.2.4'
compile 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
}
答案 0 :(得分:1)
您的依赖项之一具有不同版本的android支持库。在build.gradle root中强制使用该版本
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.0.1'
force 'com.android.support:design:27.0.1'
force 'com.android.support:appcompat-v7:27.0.1'
}
}