生成签名失败APK

时间:2020-07-25 08:14:17

标签: android

我正在尝试生成一个签名APK,以上传到Play商店,但是我遇到了错误。我取消了缓存的设置,然后重新启动了android studio,清理并重建了我的项目,更新了所有版本,并按照我在其他解决方案中看到的将multidex设置为true,但是没有一个解决此问题的。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexRelease'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Failed to transform artifact 'slf4j-api.jar (org.slf4j:slf4j-api:1.7.25)' to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-is-debuggable=false, dexing-min-sdk=16, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: C:\Users\username\.gradle\caches\transforms-2\files-2.1\bd8203a4c16d9c5bfdacf94f61ecff00\jetified-slf4j-api-1.7.25.jar.
         > Cannot parse result path string:                     

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 6s
17 actionable tasks: 9 executed, 8 up-to-date

我的应用Gradle配置如下:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "******.***.****.****"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 11223343
        versionName "2.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'


    //Google Play Services
    implementation 'com.google.android.gms:play-services-vision:20.1.0'
    implementation 'com.google.android.gms:play-services-vision-common:19.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation "com.google.android.gms:play-services-location:17.0.0"
    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation 'com.google.maps:google-maps-services:0.1.20'

    //Firebase  Service
    implementation 'com.google.firebase:firebase-analytics:17.4.4'
    implementation 'com.google.firebase:firebase-auth:19.3.2'
    implementation 'com.google.firebase:firebase-firestore:21.5.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.3'

    // Retrofit - Webservice GET & POST Request Handler
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
    implementation 'com.google.android.material:material:1.1.0'

    //Volley - Webservice GET & POST Request Handler
    implementation 'com.android.volley:volley:1.1.1'


    //Material Card implementation libraries
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'

    //Room - Local database libraries - Based on SQLite
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
    implementation 'androidx.room:room-runtime:2.2.5'
    implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
   // annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'
    annotationProcessor 'androidx.room:room-compiler:2.2.5'

    //Glide - Image processing
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'com.github.bumptech.glide:annotations:4.11.0'
    implementation('com.squareup.okhttp3:logging-interceptor:4.8.0')
    implementation('com.github.bumptech.glide:okhttp3-integration:4.0.0') {
        exclude group: 'glide-parent'
    }

    //Butterknife
    annotationProcessor 'com.jakewharton:butterknife:10.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'

    //dexter permissions
    implementation "com.karumi:dexter:5.0.0"

    // circular imageview
    implementation 'com.mikhaellopez:circularimageview:3.2.0'

    //Crop image from Gallery or Camera
    implementation 'com.github.yalantis:ucrop:2.2.2'
    implementation 'com.github.jd-alexander:library:1.1.0'

    //Beautiful Toast
    implementation 'com.github.GrenderG:Toasty:1.3.0'


    //Alert Dialog
    implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'


}

1 个答案:

答案 0 :(得分:0)

在项目根目录中,尝试删除.gradle文件夹,然后重新构建。