Android studio gradle org.gradle.process.internal.ExecException

时间:2015-12-21 16:19:33

标签: android

我的gradle是

apply plugin: 'com.android.application'  
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.tbkha"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 2
        versionName "1.0.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    repositories {
        maven {
            url 'http://swisscodemonkeys.github.io/appbrain-sdk/maven'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'

    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.github.bumptech.glide:glide:3.6.0'
    compile 'de.hdodenhof:circleimageview:1.3.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 'com.appbrain:appbrain-applift-sdk:10.51'
    compile 'com.android.support:multidex:1.0.1'
}

我遇到了这个问题:

Information:Gradle tasks [:tbkha:assembleDebug]
:tbkha:preBuild UP-TO-DATE
:tbkha:preDebugBuild UP-TO-DATE
:tbkha:checkDebugManifest
:tbkha:preReleaseBuild UP-TO-DATE
:tbkha:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:tbkha:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:tbkha:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:tbkha:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:tbkha:preDebugAndroidTestBuild UP-TO-DATE
:tbkha:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:tbkha:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:tbkha:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:tbkha:prepareComFacebookAndroidFacebookAndroidSdk410Library UP-TO-DATE
:tbkha:prepareComGithubNirhartParallaxscroll10Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE
:tbkha:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE
:tbkha:prepareDeHdodenhofCircleimageview130Library UP-TO-DATE
:tbkha:prepareDebugDependencies
:tbkha:compileDebugAidl UP-TO-DATE
:tbkha:compileDebugRenderscript UP-TO-DATE
:tbkha:generateDebugBuildConfig UP-TO-DATE
:tbkha:generateDebugAssets UP-TO-DATE
:tbkha:mergeDebugAssets UP-TO-DATE
:tbkha:generateDebugResValues UP-TO-DATE
:tbkha:generateDebugResources UP-TO-DATE
:tbkha:mergeDebugResources UP-TO-DATE
:tbkha:processDebugManifest UP-TO-DATE
:tbkha:processDebugResources UP-TO-DATE
:tbkha:generateDebugSources UP-TO-DATE
:tbkha:compileDebugJavaWithJavac UP-TO-DATE
:tbkha:compileDebugNdk UP-TO-DATE
:tbkha:compileDebugSources UP-TO-DATE
:tbkha:transformClassesWithJarMergingForDebug UP-TO-DATE
:tbkha:collectDebugMultiDexComponents UP-TO-DATE
:tbkha:transformClassesWithMultidexlistForDebug UP-TO-DATE
:tbkha:transformClassesWithDexForDebug
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
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 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 3
Information:BUILD FAILED
Information:Total time: 4 mins 38.558 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

2 个答案:

答案 0 :(得分:1)

全心全意,

我通过以下步骤解决了这个问题:

1- add(org.gradle.jvmargs = -Xmx1024m)my_project / gradle / wrapper / gradle-wrapper.properties

2-添加(dexOptions {javaMaxHeapSize" 4g"})到build.gradle。

这个问题已经解决了。

答案 1 :(得分:0)

所有java代码都需要很多内存,并且考虑到你有很多依赖项,看起来你需要更多!增加Gradle流程可用的内存。

内部your project/gradle/wrapper/gradle-wrapper.properties

添加此行

org.gradle.jvmargs=-Xmx1024m

例如,它看起来像这样:

enter image description here

请点击此处了解详情:https://docs.gradle.org/current/userguide/build_environment.html

  

org.gradle.jvmargs

     

指定用于守护程序进程的jvmargs。该设置对于调整内存设置特别有用。目前,默认设置在内存方面相当慷慨。