Firebase Java Lang Out of Memory Errror:GC开销限制超出

时间:2016-11-11 17:32:51

标签: java android firebase

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

我想知道如何解决这个问题。 当我尝试构建签名的apk时会发生这种情况。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "xxxxxxx"
        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_app_id: xxxxxxxx",
                                onesignal_google_project_number: "xxxxxx"]
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 2
        versionName "2.0"
        multiDexEnabled true


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.onesignal:OneSignal:3.+@aar'
    compile 'com.google.android.gms:play-services:9.8.0'
    compile 'com.google.android.gms:play-services-analytics:9.8.0'
    compile "com.google.android.gms:play-services-location:9.8.0"
    compile 'com.google.firebase:firebase-core:9.6.1'
    compile 'com.google.firebase:firebase-invites:9.6.1'


}
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:3)

build.gradle 文件

中添加Android闭包
  dexOptions {
       javaMaxHeapSize "4g"
    }

另请参阅以下精神解决方案链接Extremely long build with Gradle