【发布时间】:2018-08-02 02:55:32
【问题描述】:
我的 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'
}
另外,app级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 true 和 shrinkResources true,因为这两行造成了问题。
【问题讨论】:
-
谢谢你,其实我以前试过这个,但我错过了一个声明。无论如何,现在它工作了,但是当我尝试重建项目时,出现以下错误:任务':app:transformClassesAndResourcesWithProguardForDebug'的执行失败。
标签: android android-gradle-plugin build.gradle proguard android-debug