簡體   English   中英

無法構建發布 apk 版本

[英]Cannot Build release apk version

當我生成 APK 的發布版本時會出現問題。 我已經查看了這個問題並嘗試了所有提到的事情,但問題仍然存在請指出正確的方向

錯誤

錯誤:任務執行失敗:app:transformClassesWithJarMergingForRelease'。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重復條目:android/support/design/widget/CoordinatorLayout$1.class

搖籃

  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'
    }

當您使用不同版本的SDK和支持庫時,通常會發生這種情況。 替換這些版本

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

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

它應該工作。

您的SDK版本是27,而您使用
編譯'com.android.support:cardview-v7:26.0.0-alpha1'編譯'com.android.support:design:26.0.0-alpha1'

用27替換您的26

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM