【发布时间】:2018-04-30 21:23:18
【问题描述】:
Error:Execution failed for task
':app:transformClassesWithAndroidGradleClassShrinkerForDebug'.
Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them.
我该如何解决这个问题?
PS- 我也想在我的应用程序中使用progaurd。
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
dexOptions{
javaMaxHeapSize="2g"
}
defaultConfig {
applicationId "com.example.projetinnovation.newadvocatediary"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled=true
}
buildTypes {
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-andr oid.txt'),
'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android. txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://jitpack.io"
}
google()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(path: ':agendacalendarview')
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.2'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.8.+'
compile 'com.github.clans:fab:1.6.4'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.github.ybq:Android-SpinKit:1.1.0'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.github.d-max:spots-dialog:0.7@aar'
compile 'com.github.ganfra:material-spinner:2.0.0'
compile 'com.android.support:multidex:1.+'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
当您使用 minifyenabled 和 proguard 时,您的库中的某些类可能会从构建中删除。您必须确定要删除哪个类,然后添加 proguard 规则以在创建构建时保留该类。还要避免在你的 gradle 库中使用 +
标签: android android-gradle-plugin minify android-proguard android-multidex