【问题标题】:Exceptions After updating Android Studio To run FCM更新 Android Studio 后出现异常运行 FCM
【发布时间】:2016-10-12 10:44:12
【问题描述】:

我之前使用的是旧版本的 Android Studio (1.2.2),但我必须更新它,因为我在尝试在我的项目中添加 FCM 依赖项时遇到了一些错误。现在我已经更新了我的 Android Studio ( 2.1.2)连同谷歌存储库和所有。现在我收到这些错误:

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

这是我的两个构建文件:

    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'

和其他:

 // 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()
    }
}

我从昨天开始尝试使用 FCM,但我不断收到错误和异常。

【问题讨论】:

    标签: android firebase out-of-memory build.gradle firebase-cloud-messaging


    【解决方案1】:

    有时版本 9.6.1 会出错。尝试将构建文件替换为:

    编译'com.google.android.gms:play-services:9.2.1'

    编译'com.google.firebase:firebase-messaging:9.2.1'

    【讨论】:

      【解决方案2】:

      对我来说似乎是依赖问题。

      避免使用 play-services 依赖项,它将所有 Google Play 服务 API 包含到您的应用程序中。尝试仅使用您需要的单个播放服务依赖项。

      例如:

      play-services-drive
      

      查看各个 API 列表here

      【讨论】:

        【解决方案3】:

        尝试使用以下解决方案 在你的 build.gradle 中添加这个 android 闭包

         dexOptions {
             javaMaxHeapSize "4g"
           }
        

        更多信息请参考以下链接Extremely long build with Gradle

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2018-09-08
          • 2017-03-26
          • 1970-01-01
          • 2019-09-11
          • 1970-01-01
          • 1970-01-01
          • 2018-09-17
          • 2016-08-01
          相关资源
          最近更新 更多