0

我已经更新了我的应用程序,添加了 Google Admob 插页式广告,它们在我的设备和模拟器上完美运行,我没有收到任何错误,我已经尝试了一切使应用程序崩溃但没有发生。

这是 Google Play Developers Console 上显示的错误:

java.lang.RuntimeException: Unable to pause activity {com.myapp.android/com.google.ads.AdActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2859)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2815)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2793)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1224)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.myapp.android.f.a(Unknown Source)
at com.google.ads.b.w.q(Unknown Source)
at com.google.ads.AdActivity.h(Unknown Source)
at com.google.ads.AdActivity.onPause(Unknown Source)
at android.app.Activity.performPause(Activity.java:5106)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1225)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2846)
... 12 more

用户说当他们关闭广告时会发生崩溃,这是我的 onDismissScreen 方法:

@Override
public void onDismissScreen(Ad ad) {
 showInterstitial = false;
 launchChapter(getSherlockActivity().getApplicationContext());
}

private void launchChapter(Context c) {
 boolean extPlayer = Settings.getSettingPlayer(c);
 boolean extCheck = Settings.extCheck(c);
 boolean saveView = Settings.getSettingChapterView(c);

 if (saveView == true) {
  String vid = cid.replace(getString(R.string.chapter) + " ", "");
  Settings.setChapterView(c, pid + "_" + vid, true);
 }

 if (extPlayer && extCheck)
  new GetSources().initExternal(getString(R.string.url) + url, c);
 else {
  Intent intent = new Intent(c, Player.class);
  intent.putExtra("ID", cid);
  intent.putExtra("URL", url);
  intent.putExtra("TITLE", title);
  intent.putExtra("SCREEN", screen);
  startActivity(intent);
 }
}

请注意,“com.myapp.android.f”是一个片段。

4

0 回答 0