简体   繁体   English

无法构建发布 apk 版本

[英]Cannot Build release apk version

The Problem occur when i generate release version of the APK .当我生成 APK 的发布版本时会出现问题。 I have already view this question and try all things mention but problem still exists Please point me in the right direction我已经查看了这个问题并尝试了所有提到的事情,但问题仍然存在请指出正确的方向

Error错误

Error:Execution failed for task:app:transformClassesWithJarMergingForRelease'.错误:任务执行失败:app:transformClassesWithJarMergingForRelease'。 com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout$1.class com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android/support/design/widget/CoordinatorLayout$1.class

gradle摇篮

  apply plugin: 'com.android.application'

    android {
        compileSdkVersion 27
        buildToolsVersion "27.0.3"
        dexOptions {
            javaMaxHeapSize "4g"
        }
        defaultConfig {
            applicationId "com.example.wildstone.cv_maker"
            minSdkVersion 19

            versionCode 1
            versionName "1.0"
            targetSdkVersion 27

            multiDexEnabled true //important
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        }
        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:27.+'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        compile 'com.android.support:cardview-v7:26.0.0-alpha1'
        compile 'com.android.support:design:26.0.0-alpha1'
        compile 'com.android.support:multidex:1.0.1'
        compile 'com.google.android.gms:play-services:7.5.0'
        compile 'com.itextpdf:itextg:5.5.10'
        testCompile 'junit:junit:4.12'
    }

This generally happens when you are using different versions of SDK and support libraries. 当您使用不同版本的SDK和支持库时,通常会发生这种情况。 Replace the versions of these 替换这些版本

compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'

to

compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:design:27.1.0'

and it should work. 它应该工作。

your sdk version is 27 while youre using 您的SDK版本是27,而您使用
compile 'com.android.support:cardview-v7:26.0.0-alpha1' compile 'com.android.support:design:26.0.0-alpha1' 编译'com.android.support:cardview-v7:26.0.0-alpha1'编译'com.android.support:design:26.0.0-alpha1'

replace your 26's with 27's 用27替换您的26

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM