GoogleApiManager中的getApplicationContext()方法NullPointerException

时间:2019-04-25 02:01:35

标签: android firebase google-api crashlytics firebase-performance

几天前,我启动了该应用程序。我在我的应用程序中使用FireBase。但是前段时间,我遇到了未知的崩溃。

当我检查日志时,我不知道错误发生在哪里。因为这似乎是Google API中的错误,而不是我的代码中的错误。

我寻找了与此类似的问题,但找不到。错误发生已经有几天了,但仍然没有解决。

我已经升级了与Google API相关的所有模块版本。我不知道有什么其他办法。 而且我正在使用应用程序混淆服务(不是proguard),但我有点怀疑。

这是我的gradle文件依赖项

//项目级别gradle

dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.26.1'
        classpath 'com.google.firebase:firebase-plugins:1.1.5' 
    }

//应用级别gradle

dependencies {
 androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.facebook.android:facebook-login:4.38.1'
    implementation 'com.airbnb.android:lottie:2.7.0'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.google.guava:guava:27.0.1-android'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
    //Firebase Crashlytics
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
        transitive = true
    }
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-messaging:17.6.0'
    implementation 'com.google.firebase:firebase-perf:16.2.5'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support.const' +
            'raint:constraint-layout:1.0.2'
    implementation 'com.kakao.sdk:kakaolink:1.9.0'
    implementation 'com.mixpanel.android:mixpanel-android:5.5.1'
    implementation 'com.appsflyer:af-android-sdk:4+@aar'
    implementation 'com.android.installreferrer:installreferrer:1.0'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.7.3'
    implementation 'commons-beanutils:commons-beanutils:1.9.3'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
    implementation 'commons-io:commons-io:2.6'
    testImplementation 'junit:junit:4.12'

}

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

这是Firebase崩溃报告的结果。

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
       at com.google.android.gms.common.api.internal.GoogleApiManager.zab(Unknown Source:8)
       at com.google.android.gms.common.api.GoogleApi.<init>(Unknown Source:44)
       at com.google.android.gms.common.api.GoogleApi.<init>(Unknown Source:53)
       at com.google.android.gms.internal.clearcut.zze.<init>(Unknown Source:8)
       at com.google.android.gms.internal.clearcut.zze.zzb(Unknown Source:2)
       at com.google.android.gms.clearcut.ClearcutLogger.anonymousLogger(Unknown Source:2)
       at com.google.firebase.perf.internal.zzd.zzbd(Unknown Source:46)
       at com.google.firebase.perf.internal.zzd.zzb(Unknown Source:202)
       at com.google.firebase.perf.internal.zze.run(Unknown Source:2)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)

此外,在以下情况下。

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
       at com.google.android.gms.common.api.internal.GoogleApiManager.handleMessage(Unknown Source:163)
       at android.os.Handler.dispatchMessage(Handler.java:101)
       at android.os.Looper.loop(Looper.java:164)
       at android.os.HandlerThread.run(HandlerThread.java:65)

许多用户已经感到不适。有人知道问题出在哪里吗?

如果您有更多信息可以解决此问题,请告诉我。

0 个答案:

没有答案