之前我使用的是旧版Android Studio(1.2.2),但我必须更新它,因为我在尝试在我的项目中添加FCM依赖时遇到了一些错误。现在我已经更新了我的Android Studio( 2.1.2)以及Google Repository和所有。现在我收到了这些错误:
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,但我不断收到错误和异常。
答案 0 :(得分:0)
有时版本9.6.1会出错。尝试用以下代码替换构建文件:
编译com.google.android.gms:播放服务:9.2.1'
编译com.google.firebase:firebase-messaging:9.2.1'
答案 1 :(得分:0)
看起来像依赖性问题。
避免使用<div class="progress-icon" data-opt="{{list.Status}}" data-percent=" {{ (20/30)* 100)}} ">
依赖关系,它将所有Google Play服务API包含在您的应用程序中。请尝试仅使用您需要的各个播放服务依赖项。
例如:
play-services
查看各个API的列表here。
答案 2 :(得分:0)
尝试使用以下解决方案 在build.gradle中添加这个android闭包
dexOptions {
javaMaxHeapSize "4g"
}
有关详细信息,请参阅以下链接Extremely long build with Gradle