所以我的项目今天似乎随意突破,错误显然是超过65K的方法。在做了一些研究之后,我意识到是时候使用ProGuard并启用multiDex,这会让事情变得更糟。这是我在尝试创建发布APK时遇到的错误:
错误:任务执行失败 ':MY-项目:proguardRelease'
java.io.IOException:无法写[C:\ Users \ User-PC \ AndroidStudioProjects \ MyProject \ My-Project \ build \ intermediates \ classes-proguard \ release \ classes.jar](无法读取[C:\ Users \ User-PC \ AndroidStudioProjects \ MyProject \ My-Project \ libs \ bolts-android-1.2.0.jar(;;;;;;!META-INF / MANIFEST.MF)](重复的zip条目[a / a.class == bolts-android-1.2.0.jar:bolts / AggregateException.class]))
我的build.gradle文件如下所示:
apply plugin: 'com.android.application'
apply plugin: 'com.parse'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.parse.com/repo' }
}
dependencies {
classpath 'com.parse.tools:gradle:1.+'
}
}
dependencies {
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(include: 'ParseCrashReporting-*.jar', dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.github.dkharrat.nexusdialog:nexusdialog:0.2.0'
}
android {
signingConfigs {
config {
// stuff
}
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.kusasa.saleboat"
minSdkVersion 19
targetSdkVersion 21
versionCode 8
versionName "1.0.7"
// Enabling multidex support.
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
productFlavors {
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
debuggable false
}
}
}
我曾多次尝试清理和重建项目,但无济于事。
答案 0 :(得分:1)
我认为你得到这个错误是因为你在bolts-android
另一个使用My-Project\libs\bolts-android-1.2.0.jar
compile 'com.parse.bolts:bolts-android:1.+'
的两个依赖关系
删除lib文件夹中的lib。