我的格斗中有错误:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
java.io.IOException:无法写[C:\ Users \ El-Othmane \ Desktop \ tes11 \ android2 \ app \ build \ intermediates \ multi-dex \ debug \ componentClasses.jar](无法读取[C:\用户\埃尔 - Othmane.gradle \缓存\变换-1 \文件-1.1 \支持核-UI-26.1.0.aar \ 744d5e6087e939bc5d55ea9f4d6a237d \罐子\ classes.jar(;;;;;; ** 。类)] (重复的zip条目[classes.jar:android / support / v4 / view / ViewPager $ 2.class])) 在这里输入代码这是我的gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.companyname.gamename"
minSdkVersion 14
targetSdkVersion 27
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
}
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call
}
productFlavors {
}
}
dependencies {
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')
}
答案 0 :(得分:0)
首先在Gradle中添加此库:
compile 'com.android.support:multidex:1.0.0'
您还可以添加multidex:
multiDexEnabled true
并使您的应用程序扩展类MultiDexApplication
。
答案 1 :(得分:0)
放置这样的代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.companyname.gamename"
minSdkVersion 16
targetSdkVersion 25
versionCode 4
versionName "1.3"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
multiDexEnabled true
}
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:support-v4:25.4.0'
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')
}
apply plugin: 'com.google.gms.google-services'
您正在谈论如何排除V4 when you initialise the formset
您可以将V7也放在这个
中,而不是V4 compile 'com.android.support:appcompat-v7:25.4.0'
您收到此错误可能是因为Prograurd Duplicate zip entry
希望这能解决你的问题。
答案 2 :(得分:0)
错误是预期的,因为您使用的是与您的compileSdkVersion和Google Play服务冲突的旧支持库。因此,您需要将build.gradle更改为以下内容:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.companyname.gamename"
minSdkVersion 14
targetSdkVersion 27
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
}
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call
}
productFlavors {
}
}
dependencies {
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
// Don't use the following
//compile files('libs/support-v4-19.0.1.jar')
// instead, use support library with the same version with your compileSdkVersion
compile 'com.android.support:support-v4:27.1.1'
// You should NOT use all the google play service
// use what you need, please refer to https://developers.google.com/android/guides/setup
compile 'com.google.android.gms:play-services:11.2.0'
}