我在Android Studio中生成已签名的APK时遇到问题。
错误:任务执行失败':app:transformClassesWithMultidexlistForDebug'。 java.io.IOException:不能写[C:\ Users \ Ahmed \ StudioProjects \ android1 \ app \ build \ intermediates \ multi-dex \ debug \ componentClasses.jar](不能读[C: \ Users \ Ahmed.gradle \ _caches \ transforms-1 \ files-1.1 \ support-compat-25.2.0.aar \ 8a6c38a056e2992b7f752213fb56ad15 \ jars \ classes.jar(;;;;;; .class)](重复的zip条目[ classes.jar:机器人/支持/ V4 /视图/ ViewCompat.class]))
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.ahmedkarray.switchsides.colorsdash"
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call
}
}
android{
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.android.support', module: 'support-annotations'
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile ('com.google.android.gms:play-services:+'){exclude module: 'support-v4'}
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
compile ('com.android.support:multidex:1.0.1')
compile 'com.android.support:support-annotations:27.0.2'
}
答案 0 :(得分:0)
以这种方式更改您的依赖关系
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile ('com.google.android.gms:play-services:+'){
exclude module: 'support-v4'
}
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile 'com.android.support:support-v4:27.0.2'
compile 'com.android.support:mediarouter-v7:27.0.2'
compile 'com.android.support:support-compat:27.0.2'
compile 'com.android.support:support-core-ui:27.0.2'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:support-annotations:27.0.2'
}
同时更改compileSdkVersion
android {
compileSdkVersion 27
从libs文件夹中删除support-v4-19.0.1.jar