生成签名apk时,会出现此错误,但生成项目是正常的。
错误:将字节码转换为dex时出错:原因: com.android.dex.DexException:多个dex文件定义Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
gradle:
apply plugin: 'com.android.application'
repositories {
maven {
url 'https://raw.github.com/71241NW123CK/maven-repo/master'
}
}
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.baclock"
minSdkVersion 16
targetSdkVersion 23
versionCode 18
versionName "2018.02.09"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'party.treesquaredcode.android:flip-animation:0.0.2'
compile 'com.mcxiaoke.volley:library:1.0.6'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.evernote:android-job:1.2.4'
}
apply plugin: 'com.google.gms.google-services'发布于 2018-02-22 16:28:19
在默认配置中添加multiDexEnabled true,然后尝试。
defaultConfig {
applicationId "com.baclock"
minSdkVersion 16
targetSdkVersion 23
versionCode 18
versionName "2018.02.09"
multiDexEnabled true
}发布于 2018-02-22 17:02:49
在defaultConfig块中添加multiDexEnabled = true。
defaultConfig {
applicationId "com.baclock"
minSdkVersion 16
targetSdkVersion 23
versionCode 18
versionName "2018.02.09"
multiDexEnabled true
}https://stackoverflow.com/questions/48922612
复制相似问题