在Android上的应用程序的gradle,该应用程序在调试模式下完美运行到我的设备Android 5.1
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "cl.datacomputer.alejandrob.gogps"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['android-5.0.1_r1.jar'], exclude: 'android-support-v4.jar', dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile('com.android.support:appcompat-v7:23.1.0') {
exclude module: 'support-v4'
}
compile 'com.android.support:design:23.4.0'
}
这是错误,我无法理解错误在哪里,对不起,如果我的英语不好,但我试着理解,我需要你的帮助,如果你需要更多细节我放在这里,我读了所有关于这对我没什么用。
java.util.zip.zipexception: duplicate entry:android/support/annotation/colorres.class
答案 0 :(得分:0)
首先使用
编译构建使用
编译'com.google.android.gms:play-services:+'
取代
compile 'com.google.android.gms:play-services:8.4.0'
在 AndroidManifest.xml 中也进行了更改,添加以下行 android:name
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="android.support.multidex.MultiDexApplication"
>
在 build.gradle 中也添加
dexOptions {
//incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
答案 1 :(得分:0)
您使用的是版本23.1.0和23.4.0,请尝试使用
compile('com.android.support:appcompat-v7:23.4.0') {
exclude module: 'support-v4'
}
答案 2 :(得分:0)
只需删除此行 -
{
compile 'com.google.android.gms:play-services:8.4.0'
}
或尝试
{
compile 'com.google.android.gms:play-services:7.0.0'
}