2016-02-25 45 views
2

建設過程中我的項目,我得到一個gradle這個生成錯誤:的Android工作室gradle這個異常(SDK 23.2.0,改造2,谷歌服務8.4)

Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded 

1的錯誤;墮胎

爲什麼會發生這種情況?

完整的日誌低於

我gradle這個是:

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.android.support:design:23.2.0' 
    compile 'com.android.support:support-v4:23.2.0' 
    compile 'com.android.support:cardview-v7:23.2.0' 
    compile 'com.android.support:recyclerview-v7:23.2.0' 

    compile 'com.j256.ormlite:ormlite-android:4.48' 
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4' 
    compile 'com.squareup.okhttp3:okhttp:3.0.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4' 

    compile 'com.github.bumptech.glide:glide:3.6.0' 
    compile 'com.github.nirhart:parallaxscroll:1.0' 

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

    compile 'de.hdodenhof:circleimageview:1.3.0' 
    compile 'com.appbrain:appbrain-applift-sdk:10.51' 
    compile 'com.android.support:multidex:1.0.1' 
} 

返回此異常:

Information:Gradle tasks [:app:assembleDebug] 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:checkDebugManifest 
:app:preReleaseBuild UP-TO-DATE 
:app:prepareComAndroidSupportAnimatedVectorDrawable2320Library UP-TO-DATE 
:app:prepareComAndroidSupportAppcompatV72320Library UP-TO-DATE 
:app:prepareComAndroidSupportCardviewV72320Library UP-TO-DATE 
:app:prepareComAndroidSupportDesign2320Library UP-TO-DATE 
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE 
:app:preDebugAndroidTestBuild UP-TO-DATE 
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE 
:app:prepareComAndroidSupportRecyclerviewV72320Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42320Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportVectorDrawable2320Library UP-TO-DATE 
:app:prepareComFacebookAndroidFacebookAndroidSdk410Library UP-TO-DATE 
:app:prepareComGithubNirhartParallaxscroll10Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE 
:app:prepareDeHdodenhofCircleimageview130Library UP-TO-DATE 
:app:prepareDebugDependencies 
:app:compileDebugAidl UP-TO-DATE 
:app:compileDebugRenderscript UP-TO-DATE 
:app:generateDebugBuildConfig UP-TO-DATE 
:app:generateDebugAssets UP-TO-DATE 
:app:mergeDebugAssets UP-TO-DATE 
:app:generateDebugResValues UP-TO-DATE 
:app:generateDebugResources UP-TO-DATE 
:app:mergeDebugResources UP-TO-DATE 
:app:processDebugManifest UP-TO-DATE 
:app:processDebugResources UP-TO-DATE 
:app:generateDebugSources UP-TO-DATE 
:app:compileDebugJavaWithJavac UP-TO-DATE 
:app:compileDebugNdk UP-TO-DATE 
:app:compileDebugSources UP-TO-DATE 
:app:transformClassesWithJarMergingForDebug UP-TO-DATE 
:app:collectDebugMultiDexComponents UP-TO-DATE 
:app:transformClassesWithMultidexlistForDebug UP-TO-DATE 
:app:transformClassesWithDexForDebug 
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded 
1 error; aborting 
Error:Execution failed for task ':tbkha:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1 
Information:BUILD FAILED 
Information:Total time: 2 mins 39.656 secs 
Information:1 error 
Information:0 warnings 
Information:See complete output in console 

我怎麼能解決這個問題?

+0

你嘗試過增加可用於gradle進程的內存? 你可以通過替換org.gradle.jvmargs = -Xmx1024m的值在gradle-wrapper.properties –

+0

是的,我試過,但它沒有工作 –

回答

3
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded  
Error:Execution failed for task ':tbkha:transformClassesWithDexForDebug'. 

看起來像這樣發生是因爲在將java代碼轉換爲dex時,gradle運行時內存不足。

您可以通過更改'gradle-wrapper.properties'(通常位於/{project_name}/gradle/wrapper/gradle-wrapper.properties)來增加分配給gradle的內存。

所有你需要做的是,添加以下行它

org.gradle.jvmargs=-Xmx1024m 

編輯

您也可以在建的build.gradle提高javaMaxHeapSize

android { 
    dexOptions { 
     javaMaxHeapSize = "4g" 
       } 
     } 
+0

我做了,但它沒有工作 –

+0

然後,嘗試加入 的Android { dexOptions { javaMaxHeapSize 「4G」 }} 到的build.gradle –

+0

謝謝它工作得很好:) –

相關問題