问题
With AdWhirl I got these Exceptions...
I Couldn't found Wrong from my Side...
Could anyone Suggest on this..
FATAL EXCEPTION: main
E/AndroidRuntime( 279): java.lang.NullPointerException
E/AndroidRuntime( 279): at android.webkit.WebView.requestFocus(WebView.java:6081)
E/AndroidRuntime( 279): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073)
E/AndroidRuntime( 279): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029)
E/AndroidRuntime( 279): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073)
E/AndroidRuntime( 279): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029)
E/AndroidRuntime( 279): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073)
E/AndroidRuntime( 279): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029)
E/AndroidRuntime( 279): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073)
E/AndroidRuntime( 279): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029)
E/AndroidRuntime( 279): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073)
E/AndroidRuntime( 279): at android.view.ViewGroup.requestFocus(ViewGroup.java:1029)
E/AndroidRuntime( 279): at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:1073)
E/AndroidRuntime( 279): at android.view.ViewGroup.requestFocus(ViewGroup.java:1032)
E/AndroidRuntime( 279): at android.view.View.requestFocus(View.java:3556)
E/AndroidRuntime( 279): at android.view.View.requestFocus(View.java:3534)
E/AndroidRuntime( 279): at android.view.ViewRoot.focusableViewAvailable(ViewRoot.java:1611)
E/AndroidRuntime( 279): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:451)
E/AndroidRuntime( 279): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:451)
E/AndroidRuntime( 279): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:451)
E/AndroidRuntime( 279): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:451)
E/AndroidRuntime( 279): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:451)
E/AndroidRuntime( 279): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:451)
E/AndroidRuntime( 279): at android.view.View.setFlags(View.java:4493)
E/AndroidRuntime( 279): at android.view.View.setVisibility(View.java:3030)
E/AndroidRuntime( 279): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:668)
E/AndroidRuntime( 279): at android.widget.TabHost.setCurrentTab(TabHost.java:323)
E/AndroidRuntime( 279): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:129)
E/AndroidRuntime( 279): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:453)
E/AndroidRuntime( 279): at android.view.View.performClick(View.java:2408)
E/AndroidRuntime( 279): at android.view.View$PerformClick.run(View.java:8816)
E/AndroidRuntime( 279): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 279): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 279): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 279): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 279): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 279): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 279): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 279): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 279): at dalvik.system.NativeStart.main(Native Method)
回答1:
This is a bug in Android that seems to be exposed by the AdMob SDK. In my experience it hasn't been deterministic, and has been a pretty rare exception on devices.
回答2:
I got the exact same error on my app since I added this code in my main activity:
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
It seems to be an exception coming from the Admob part. In this discussion, Eric Leichtenschlag from the Admob SDK support team explains that the code above can actually be skipped for Android 2.1+:
The call to AdView.destroy() isn't as important if you are running Android 2.1+, as I'm not sure there are any known WebView crashes on Android 2.1+ devices. If not making this call is indeed a workaround to this error, it is your best short term bet. We don't want this to be the long term solution though. The AdView.destroy() call lets us clean up the AdView properly, and it is intended to prevent catch these WebView errors, not cause them.
来源:https://stackoverflow.com/questions/9818028/issues-with-adwhirladmobinmobi