ProGuard 配置解析错误,启用后 "minifyEnabled"

ProGuard Configuration Parse Error, after enabling "minifyEnabled"

我的 Android 项目运行良好,但是当我启用此选项时 minifyEnabled true 我收到以下错误:

com.android.build.gradle.shrinker.parser.ProguardParserException: ProGuard configuration parser error:
    /Users/mss/.gradle/caches/transforms-1/files-1.1/play-services-base-11.8.0.aar/a9e603bf098b2c6866a5bdd73147cdc0/proguard.txt line 3:88 no viable alternative at input '<fields>'

这是我每次尝试使用 minifyEnabled true 运行 我的应用程序时收到的错误。这个问题有什么解决办法吗

我在我的项目中使用的依赖项是这些:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.google.android.gms:play-services-auth:11.8.0'

    // Circle Image View
    implementation 'de.hdodenhof:circleimageview:2.2.0'

    // Firebase Dependencies
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.firebase:firebase-crash:11.8.0'

    // Firebase UI Dependencies
    implementation 'com.firebaseui:firebase-ui-auth:3.1.0'

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

此外,应用级别build.gradle文件的配置是这些:

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

    debug {
        debuggable true
     // minifyEnabled true
     // shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

我评论了两行 minifyEnabled trueshrinkResources true 因为这两行造成了问题。

proguard 问题。 对所有库使用 keep class

您必须为添加的每个库添加自定义混淆器规则。

有关 Firebase 规则,请查看此处; link

大多数图书馆列出了他们使用的程序规则,查看图书馆详细信息,您会找到它们。

此外查看 FirebaseUI-Android 应用混淆器文件 here