我收到以下错误:
09-04 10:45:50.429 4841-4869 E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
Process: com.xxx.xxx, PID: 4841
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Set java.util.Map.keySet()' on a null object reference
at com.google.android.gms.internal.zzalt.zza(Unknown Source)
at com.google.android.gms.internal.zzalt.run(Unknown Source)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
只有当我添加远程配置 firebase 代码时,才会出现此错误,正如他们在项目代码示例中所解释的那样。
这是我的毕业生:
apply plugin: 'com.android.application'
android {
compileSdkVersion "Google Inc.:Google APIs:23"
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.batriks.getblue"
minSdkVersion 15
targetSdkVersion 20
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':slidingMenu')
compile project(':flip3DViewTransition')
compile project(':facebookSDK')
compile files('libs/universal-image-loader-1.9.2.jar')
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
// compile 'com.google.android.gms:play-services-ads:9.2.0'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-config:9.0.2'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
//compile 'com.google.android.gms:play-services:7.8.0'
}
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.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
我还添加了 google-services.json,并证明了几个库配置,但似乎没有任何效果。
我怎么解决这个问题?