0

I was using an older version of Android Studio (1.2.2) before but I have to update it because I was getting some errors as I try to add FCM dependency on my project.Now that I have update my Android Studio (2.1.2) along with Google Repository and all. Now I'm getting these errors:

Error:Exception in thread "pool-2-thread-2" java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:7 errors; aborting
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED

Here are both of my build files:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.3"

        defaultConfig {
            applicationId "app.com.example.saeed.fypmerged"
            minSdkVersion 18
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.google.android.gms:play-services:9.6.1'
        compile 'com.google.firebase:firebase-messaging:9.6.1'
        compile 'com.firebase:firebase-client-android:2.5.2'
        compile files('libs/GenAsync.jar')
    }
    apply plugin: 'com.google.gms.google-services'

and the other:

 // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

I'm trying to use FCM since yesterday, but I keep getting errors and exceptions.

AL.
  • 36,815
  • 10
  • 142
  • 281
shahtaj khalid
  • 476
  • 7
  • 24

3 Answers3

0

Sometime version 9.6.1 gives error. Try replacing build files with:

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

compile 'com.google.firebase:firebase-messaging:9.2.1'

Myth
  • 1,218
  • 12
  • 15
0

Looks like dependency issues to me.

Avoid using the play-services dependency, it includes all Google Play services APIs into your application. Try using only the individual play-services dependencies that you need.

Eg:

play-services-drive

See the list of individual APIs here.

Arthur Thompson
  • 9,087
  • 4
  • 29
  • 33
0

Try to use below solution Add this android closure in your build.gradle

 dexOptions {
     javaMaxHeapSize "4g"
   }

For more information Refer below link Extremely long build with Gradle

Nitin Karande
  • 1,280
  • 14
  • 33