应用程式套件Proguard错误

时间:2018-08-21 13:42:50

标签: android google-play google-play-console

我正在尝试将应用上传到Google Play控制台,但其说法Your Android App Bundle contains an invalid Proguard deobfuscation file. console error

我的Proguard文件是

-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
public static java.lang.String TABLENAME;
}
-keep class **$Properties
-dontwarn org.greenrobot.greendao.database.**
-dontwarn rx.**

-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception

-dontwarn org.codehaus.**
-dontwarn com.google.errorprone.annotations.**
-keep class android.support.v7.widget.SearchView { *; }

#Glide
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl

应用程序级别build.gradle:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

def gitSha = 'git rev-parse --short HEAD'.execute().text.trim()
project.logger.debug('git sha: ' + gitSha)

def applicationName = "App name"

android {
    signingConfigs {

        release {
            ...
        }
    }

    compileSdkVersion 27
    buildToolsVersion '28.0.0'
    buildTypes {
        release {
            applicationIdSuffix ".release"
            signingConfig signingConfigs.release
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            renameAPK(applicationName,'RELEASE')
        }
        debug {
            applicationIdSuffix ".debug"
            multiDexEnabled true
            renameAPK(applicationName,'DEBUG')
        }
    }
    defaultConfig {
        applicationId "com.app.id"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }


}

def renameAPK(applicationName,buildType) {
    def formattedDate = new Date().format('dd-MM-yy')
    project.ext.set("archivesBaseName", "${applicationName}-${buildType}-${formattedDate}".toString())
}

greendao {
    schemaVersion 2
}

dependencies {
    implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:design:$rootProject.supportLibraryVersion"
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
    implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
    implementation "com.google.android.gms:play-services-location:15.0.1"
    implementation "com.google.firebase:firebase-core:16.0.1"
    implementation "com.google.firebase:firebase-messaging:17.1.0"
    implementation "com.google.firebase:firebase-perf:16.0.0"
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
    implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
    implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
    annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
    implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
    compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
    implementation 'org.greenrobot:greendao:3.2.2'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
        transitive = true
    }
    implementation 'javax.annotation:javax.annotation-api:1.3.2'
    annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion"
    implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"
    implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
    implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
    implementation 'com.jakewharton.timber:timber:4.6.0'
    implementation 'us.belka:androidtoggleswitch:1.2.2'
    implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
    implementation 'com.github.jkwiecien:EasyImage:1.3.1'
    implementation 'id.zelory:compressor:2.1.0'
    testImplementation 'junit:junit:4.12'
    testImplementation "org.mockito:mockito-core:$rootProject.mockitoVersion"
    androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
    testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
    androidTestAnnotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
    androidTestImplementation "org.mockito:mockito-core:$rootProject.mockitoVersion"
    androidTestImplementation("com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion", {
        exclude group: "com.android.support", module: "support-annotations"
    })
    androidTestImplementation "com.android.support.test.espresso:espresso-intents:$rootProject.espressoVersion"
    debugImplementation "com.amitshekhar.android:debug-db:$rootProject.debugDBVersion"
    devImplementation "com.amitshekhar.android:debug-db:$rootProject.debugDBVersion"
    debugImplementation "com.squareup.leakcanary:leakcanary-android:$rootProject.leakCanaryVersion"
    debugImplementation "com.android.support:multidex:$rootProject.multidexVersion"
    devImplementation "com.android.support:multidex:$rootProject.multidexVersion"
    devImplementation "com.squareup.leakcanary:leakcanary-android:$rootProject.leakCanaryVersion"
    releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakCanaryVersion"
}

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

configurations.all {
    resolutionStrategy.force "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
}

和顶级build.gradle

   buildscript {
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.3.0-alpha02'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
            classpath 'com.google.gms:google-services:3.2.0'
            classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
            classpath 'com.google.firebase:firebase-plugins:1.1.5'
        }
    }

    allprojects {
        repositories {
            jcenter()
            maven { url "https://jitpack.io" }

            google()
        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

    // Define versions in a single place
    ext {

        // App dependencies
        supportLibraryVersion = '27.1.1'
        glideVersion = '4.7.1'
        retrofitVersion = '2.3.0'
        dagger2Version = '2.16'
        butterKnifeVersion = '8.8.1'
        debugDBVersion = '1.0.1'
        playServicesVersion = '12.0.1'
        leakCanaryVersion = '1.5.4'
        multidexVersion = '1.0.3'

        //Test dependencies
        junitVersion = '4.12'
        espressoVersion = '2.3-alpha'
        mockitoVersion = '2.7.1'
    }

谢谢。

1 个答案:

答案 0 :(得分:0)

  

您的Android应用程序捆绑包包含无效的Proguard混淆处理   文件。

阅读Decode an obfuscated stack trace

ProGuard每次运行时都会创建一个mapping.txt文件,该文件显示映射到混淆名称的原始类,方法和字段名称。 ProGuard将文件保存在应用程序 <module-name>/build/outputs/mapping/release/ directory 中。

请注意,每次使用ProGuard创建发行版时,mapping.txt文件都会被覆盖,因此,每次发布新发行版时,必须仔细保存副本。通过为每个发行版保留mapping.txt文件的副本,如果用户从较早版本的应用程序提交了模糊的堆栈跟踪,就可以调试问题。

阅读Upload a ProGuard mapping file