3

My gradle is

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'
}

I face this problem:

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
Rick Sanchez
  • 3,793
  • 1
  • 22
  • 40
Ahmed Mohammed
  • 337
  • 2
  • 15

2 Answers2

1

Thanks all,

I solved this problem by this steps:

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

2- add (dexOptions { javaMaxHeapSize "4g" }) to build.gradle.

This problem is solved.

Ahmed Mohammed
  • 337
  • 2
  • 15
0

It takes a lot of memory to dex all that java code, and considering you have a lot of dependencies it looks likes you need a lot more! Increase the memory available to your Gradle process.

Inside your project/gradle/wrapper/gradle-wrapper.properties

add this line

org.gradle.jvmargs=-Xmx1024m

For instance it could look like this:

enter image description here

See here for more: https://docs.gradle.org/current/userguide/build_environment.html

org.gradle.jvmargs

Specifies the jvmargs used for the daemon process. The setting is particularly useful for tweaking memory settings. At the moment the default settings are pretty generous with regards to memory.

Community
  • 1
  • 1
Blundell
  • 69,653
  • 29
  • 191
  • 215