繁体   English   中英

Android应用程序无法生成带签名的apk,错误com.android.build.api.transform.TransformException:java.util.zip.ZipException:

[英]Android App Unable to generate signed apk with error com.android.build.api.transform.TransformException: java.util.zip.ZipException:

我当时正在生成要发布的APK,但是面临着APK的以下问题。

卡住 @

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/gcm/PendingCallback.class

无法进一步解决此问题。

尝试了其他所有可能的方法来摆脱此错误。

这是我的Gradle文件的快照

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.xxxxxxxxxxx.xxxxx"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        versionName getVersionName()
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        useLibrary 'org.apache.http.legacy'

    }
    dexOptions {
        jumboMode true
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    defaultConfig {
        multiDexEnabled = true
        vectorDrawables.useSupportLibrary = true
    }
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
        all*.exclude group: 'com.android.support', module: 'support-annotations'
        all*.exclude module: 'play-services-awareness'

    }

}


//repositories {
//    maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
//}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:support-vector-drawable:27.1.0'
    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:cardview-v7:27.1.0'
    compile 'com.github.silvestrpredko:dot-progress-bar:1.1'
    compile 'com.github.d-max:spots-dialog:0.4@aar'
    compile 'com.github.clans:fab:1.6.2'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.prolificinteractive:material-calendarview:1.4.3'
    compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    compile 'com.synnapps:carouselview:0.1.4'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.lawloretienne:discreteslider:0.0.9'
    compile 'com.appyvet:materialrangebar:1.4.1'
    compile 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'

    //Swipe stack card Intergrtion
    compile 'link.fls:swipestack:0.3.0'
    compile 'in.arjsna:swipecardlib:1.0.2'
    compile 'com.borax12.materialdaterangepicker:library:1.9'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation project(':aphidFlipViewLibrary')
    compile 'com.gjiazhe:PanoramaImageView:1.0'
    implementation 'com.github.Q42:AndroidScrollingImageView:1.3.2'
    compile 'com.github.lespinsideg:SimplePanorama:0.3.1'

    compile ('co.realtime:messaging-android:2.1.58'){
        exclude group: 'com.google.android.gms', module: 'play-services'
    }
    //gmail intergation
    compile 'com.google.android.gms:play-services-auth:11.8.0'
    compile 'com.google.firebase:firebase-core:11.8.0'
    compile 'com.google.android.gms:play-services-maps:11.8.0'
    compile 'com.google.android.gms:play-services:11.8.0'
    compile 'com.google.android.gms:play-services-places:11.8.0'
    compile 'com.google.android.gms:play-services-location:11.8.0'


    compile 'com.mxn.soul:flowingdrawer-core:2.0.0'
    compile 'com.yalantis:contextmenu:1.0.7'
    compile 'com.github.florent37:materialimageloading:1.0.2'
    compile 'com.pnikosis:materialish-progress:1.7'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
    compile 'ch.acra:acra:4.6.1'
    compile 'com.github.clans:fab:1.6.2'
    compile 'com.koushikdutta.ion:ion:2.+'
    compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
    compile 'com.squareup.okio:okio:1.7.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.1'
    compile 'pub.devrel:easypermissions:0.2.0'
    compile 'com.github.silvestrpredko:dot-progress-bar:1.1'
    implementation 'com.android.support:mediarouter-v7:27.1.0'
    compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
    compile 'com.firebase:firebase-jobdispatcher:0.5.2'
    compile 'com.android.support:multidex:1.0.1'
    compile 'de.hdodenhof:circleimageview:2.2.0'

    //gcm error
    compile 'com.adjust.sdk:adjust-android-criteo:4.12.4'
    compile 'com.seatgeek:placesautocomplete:0.3-SNAPSHOT'
    implementation 'com.jakewharton:butterknife:8.4.0'
    //ZENDEX
    implementation group: 'com.zendesk', name: 'support', version: '2.0.0'
   // compile project(':sdkui')
    implementation 'com.github.takusemba:spotlight:1.3.3'

}
apply plugin: 'com.google.gms.google-services'

您在默认配置结构中都重复了multiDexEnabled = true 删除其中之一。

在应用模块中启用multidex

defaultConfig {
     multiDexEnabled true
    }

    dependencies {   
        implementation'com.android.support:multidex:1.0.1'
    }

还为应用程序标记设置名称属性,例如

<application
        android:name="android.support.multidex.MultiDexApplication" >
</application>

暂无
暂无

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

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