【发布时间】:2017-03-09 06:46:13
【问题描述】:
我在我的项目中使用multidex enabled。当我使用 minifyEnabled true 时出现此错误
FAILURE: Build failed with an exception.
- 出了什么问题:
任务 ':app:transformClassesAndResourcesWithProguardForRelease' 执行失败。
作业失败,查看日志了解详情
这是我的 gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.app.example"
minSdkVersion 15
targetSdkVersion 25
versionCode 9
versionName "1.8"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
productFlavors {
}
lintOptions {
checkReleaseBuilds false
}
}
repositories {
maven {
url 'https://dl.bintray.com/ayz4sci/maven/'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:multidex:1.0.1'
}
UPDATE(在看到 kevin 建议的日志后)
-
我添加这行不要警告
-dontwarn com.squareup.picasso.** -dontwarn com.vungle.** -dontwarn twitter4j.**
和它的工作,但我正在使用 d-max/spots-dialog 并且它在签名 apk 后没有显示
也可以使用 -keep class 解决。
【问题讨论】: