Android NPE与Admob非页内广告

时间:2013-10-09 22:23:08

标签: java android eclipse nullpointerexception admob

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

这是Google Play开发者控制台上显示的错误:

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'是一个片段。

0 个答案:

没有答案