0

此问题仅显示 Android 版本 8.1.0 的 Vivo 手机。

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mehindiapp/com.mehindiapp.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2901)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2979)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1683)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:192)
       at android.app.ActivityThread.main(ActivityThread.java:6753)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:550)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828)

我试图更新库版本,但问题仍然存在。我无法找到主要问题。无论是在库中还是在代码中

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
       at android.app.ApplicationErrorReport$CrashInfo.writeToParcel(ApplicationErrorReport.java:445)
       at android.os.StrictMode$ViolationInfo.writeToParcel(StrictMode.java:2658)
       at android.os.StrictMode.writeGatheredViolationsToParcel(StrictMode.java:2122)
       at android.os.Parcel.writeNoException(Parcel.java:1936)
       at com.google.android.gms.ads.internal.client.as.a(as.java:8)
       at ff.onTransact(ff.java:4)
       at android.os.Binder.transact(Binder.java:628)
       at cnk.a(cnk.java:2)
       at com.google.android.gms.ads.internal.client.k.newAdManagerByType(k.java:23)
       at com.google.android.gms.ads.AdManagerCreatorImpl.newAdManagerByType(AdManagerCreatorImpl.java:6)
       at com.google.android.gms.ads.internal.client.l.a(l.java:8)
       at cnl.onTransact(cnl.java:5)
       at android.os.Binder.transact(Binder.java:628)
       at com.google.android.gms.internal.ads.zzfn.transactAndReadException(zzfn.java:7)
       at com.google.android.gms.internal.ads.zzvp.zza(zzvp.java:23)
       at com.google.android.gms.internal.ads.zztv.zza(zztv.java:19)
       at com.google.android.gms.internal.ads.zzum.zzof(zzum.java:15)
       at com.google.android.gms.internal.ads.zzus.zzoi(zzus.java)
       at com.google.android.gms.internal.ads.zzus.zzd(zzus.java:77)
       at com.google.android.gms.internal.ads.zzxd.zza(zzxd.java:46)
       at com.google.android.gms.ads.InterstitialAd.loadAd(InterstitialAd.java:6)
       at com.mehindiapp.MainActivity.showInterstitialAd(MainActivity.java:25)
       at com.mehindiapp.MainActivity.onCreate(MainActivity.java:30)
       at android.app.Activity.performCreate(Activity.java:7166)
       at android.app.Activity.performCreate(Activity.java:7157)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2854)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2979)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1683)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:192)
       at android.app.ActivityThread.main(ActivityThread.java:6753)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:550)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:828)

使用的库版本:

// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-core:17.2.1'

// Add the SDK for Firebase Cloud Messaging
implementation 'com.google.firebase:firebase-messaging:20.0.0'

// Add the SDK for Firebase Crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

// Add the SDK for Firebase AdMob
implementation 'com.google.firebase:firebase-ads:18.2.0'

classpath 'com.google.gms:google-services:4.3.0'

请任何人帮助我解决这个问题。这里显示了一些内部错误。

4

1 回答 1

0

只需在 POJO 类中替换

@SerializedName("is_demo")
@Expose
private Boolean isDemo;

@SerializedName("is_demo")
@Expose
private boolean isDemo;

虽然早些时候相同的代码有效

于 2019-12-11T14:51:10.770 回答