0

gradle这个Android上的应用程序的Android应用程序,该应用程序运行完全在调试模式下我的设备是Android 5.1你好,我是在编程时,它能增强APK编译失败

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

蒂姆Castelijns我如何做到这一点?,这是我第一次在Android Studio和Gradle。 –

+0

你在那里有一些文档:https://developers.google.com/android/guides/setup 通过使用'compile'c​​om.google.android.gms:play-services:8.4.0''您的应用程序将包括所有服务。可能你并不需要其中的大部分......如果你只需要Google+,你应该使用'com.google.android.gms:play-services-plus:8.4.0'来使用\t。您可以在上面的链接上获得表1中每项服务的详细信息。 – guillaume

回答

0

首先编译构建与

使用的

编译 'com.google.android.gms:发挥服务:+'

而不是

compile 'com.google.android.gms:play-services:8.4.0' 

,并在你的AndroidManifest.xml中改变添加此行的android:命名

<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 
} 
+0

不要工作,:/相同的错误。 –

0

你正在使用版本23.1.0和23.4.0尝试此代替

compile('com.android.support:appcompat-v7:23.4.0') { 
    exclude module: 'support-v4' 
} 
+0

不要工作,:/同样的错误。 –

0

就删除此行 -

{ 
    compile 'com.google.android.gms:play-services:8.4.0' 
} 

或尝试

{ 
    compile 'com.google.android.gms:play-services:7.0.0' 
} 
+0

不要工作,:/同样的错误。 –

+0

你可以运行这个命令'./gradlew app:dependencies'并列出结果吗? – guillaume

+0

这是命令的输出: https://drive.google.com/open?id=0B5v1cGSkTXBjTGF1NEVYelFYNEk –