2016-04-18 15 views
0

有一个gradle问题,我的应用程序不会编译并在“0:消息”选项卡上出现此错误,这里我的代码在我的build.gradle(应用程序)执行失败':app:transformClassesWithDexForDebug' - 超出GC开销限制

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "app.nucleo.com.doctoc" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
dexOptions { 
    incremental = true; 
    preDexLibraries = false 
    javaMaxHeapSize "4g" // 2g should be also OK 
} 

} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile project(path: ':backend', configuration: 'android-endpoints') 
    compile 'com.android.volley:volley:1.0.0' 
    compile 'com.android.support:appcompat-v7:24.0.0-alpha2' 
    compile 'com.android.support:support-v4:24.0.0-alpha2' 
    compile 'com.android.support:design:24.0.0-alpha2' 
    compile 'com.google.android.gms:play-services:8.4.0' 
    compile 'com.google.android.gms:play-services-gcm:8.4.0' 
    compile 'com.google.android.gms:play-services-auth:8.4.0' 
    compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.28' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.google.android.gms:play-services-ads:8.4.0' 
} 

截图:

http://i.stack.imgur.com/6BTaw.png

任何能帮助我吗?从你的依赖

+0

尝试增加构建引擎的堆大小:http://stackoverflow.com/a/25013822/115145 – CommonsWare

+0

但我尝试解决方案 –

回答

0

删除:

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

,准确地为您需要play-serviceshere还有什么期待。

+0

谢谢,但问题仍然存在:( –

+0

如果您已经精细调整了所选的播放服务你现在可以删除multidex = true并且它会工作,至少在理论上 – Tatarize

-1
андроид { 
    compileSdkVersion 24 
    buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "app.nucleo.com.doctoc" 
    minSdkVersion 16 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
} targetSdkVersion 24 
+0

compileSdkVersion ---> 24和targetSdkVersion ----> 24 – Turalllb

+0

这应该是一个答案吗? –

0

微调你的播放服务,所以你不包括整个包。那么它不会超过64k函数限制,你可以删除我假设你添加的multidex事物,因为它是反对的。

multiDexEnabled false 

而确切的播放服务,因此它都适合在同一个dex文件。

相关问题