Firebase Java语言内存不足错误:超出GC开销限制

Firebase Java语言内存不足错误:超出GC开销限制,java,android,firebase,Java,Android,Firebase,请告诉我,我想知道如何解决这个问题。 它发生在我试图构建签名的apk时 Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded 在build.gradle文件中添加android闭包 apply plugin: 'com.android.application' android {

请告诉我,我想知道如何解决这个问题。 它发生在我试图构建签名的apk时

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

build.gradle文件中添加android闭包

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'
另请参阅下面的解决方案链接

  dexOptions {
       javaMaxHeapSize "4g"
    }