我正在尝试整合到我的游戏startapp中,从一个活动更改为另一个活动,宣传和广告正确显示我,但点击广告时会出现以下错误。
java.lang.RuntimeException: java.lang.Throwable: Warning: A WebView method was called on thread 'Thread-1082'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
at android.webkit.WebView.checkThread(WebView.java:1927)
at android.webkit.WebView.destroy(WebView.java:641)
at com.startapp.android.publish.AppWallActivity$6.run(Unknown Source)
at com.startapp.android.publish.d.l$a$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.Throwable: Warning: A WebView method was called on thread 'Thread-1082'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
at android.webkit.WebView.checkThread(WebView.java:1918)
有谁知道它为什么会这样?
这是我用来打开它的代码:
startAppAd.showAd(new AdDisplayListener()
{
public void adDisplayed(Ad arg0) {
// TODO Auto-generated method stub
}
public void adHidden(Ad arg0) {
Intent i = new Intent(getApplicationContext(), SeleccionarLigaActivity.class);
i.putExtra("PrimeraVez", primeraVez);
startActivity(i);
}
});
我也试过这个:
MainActivity.this.runOnUiThread(new Runnable() {
public void run() {
startAppAd.showAd();
startAppAd.loadAd();
}
});
现在使用2.0.5提供此错误:
11-20 23:13:26.230: E/ActivityThread(23199): Activity com.startapp.android.publish.AppWallActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@42571a48 that was originally bound here
11-20 23:13:26.230: E/ActivityThread(23199): android.app.ServiceConnectionLeaked: Activity com.startapp.android.publish.AppWallActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@42571a48 that was originally bound here
11-20 23:13:26.230: E/ActivityThread(23199): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:974)
11-20 23:13:26.230: E/ActivityThread(23199): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:868)
11-20 23:13:26.230: E/ActivityThread(23199): at android.app.ContextImpl.bindServiceAsUser(ContextImpl.java:1452)
11-20 23:13:26.230: E/ActivityThread(23199): at android.app.ContextImpl.bindService(ContextImpl.java:1440)
11-20 23:13:26.230: E/ActivityThread(23199): at android.content.ContextWrapper.bindService(ContextWrapper.java:496)
11-20 23:13:26.230: E/ActivityThread(23199): at android.speech.tts.TextToSpeech.connectToEngine(TextToSpeech.java:685)
11-20 23:13:26.230: E/ActivityThread(23199): at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:655)
11-20 23:13:26.230: E/ActivityThread(23199): at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:608)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.AccessibilityInjector$TextToSpeechWrapper.<init>(AccessibilityInjector.java:682)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.AccessibilityInjector.addTtsApis(AccessibilityInjector.java:483)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.AccessibilityInjector.addAccessibilityApisIfNecessary(AccessibilityInjector.java:168)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.AccessibilityInjector.updateJavaScriptEnabled(AccessibilityInjector.java:418)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.WebViewClassic.updateJavaScriptEnabled(WebViewClassic.java:1682)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.WebSettingsClassic.setJavaScriptEnabled(WebSettingsClassic.java:1125)
11-20 23:13:26.230: E/ActivityThread(23199): at com.startapp.android.publish.d.m.a(Unknown Source)
11-20 23:13:26.230: E/ActivityThread(23199): at com.startapp.android.publish.AppWallActivity.a(Unknown Source)
11-20 23:13:26.230: E/ActivityThread(23199): at com.startapp.android.publish.AppWallActivity.a(Unknown Source)
11-20 23:13:26.230: E/ActivityThread(23199): at com.startapp.android.publish.AppWallActivity$b.shouldOverrideUrlLoading(Unknown Source)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:261)
11-20 23:13:26.230: E/ActivityThread(23199): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:363)
11-20 23:13:26.230: E/ActivityThread(23199): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 23:13:26.230: E/ActivityThread(23199): at android.os.Looper.loop(Looper.java:137)
11-20 23:13:26.230: E/ActivityThread(23199): at android.app.ActivityThread.main(ActivityThread.java:5103)
11-20 23:13:26.230: E/ActivityThread(23199): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 23:13:26.230: E/ActivityThread(23199): at java.lang.reflect.Method.invoke(Method.java:525)
11-20 23:13:26.230: E/ActivityThread(23199): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-20 23:13:26.230: E/ActivityThread(23199): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-20 23:13:26.230: E/ActivityThread(23199): at dalvik.system.NativeStart.main(Native Method)
致以问候和感谢。
答案 0 :(得分:1)
不在新线程中,WebView应该在UI Thread中使用
或者你可以看到答案〜 WebView Methods is not called in android
答案 1 :(得分:0)
我是StartApp的Miki。
您遇到的问题似乎与您的应用相关,因为我们以前从未体验过它。因此,我们的支持团队需要进一步调查,需要检查您的特定应用。 请通过开发人员门户网站或support@startapp.com与我们联系,并提供尽可能多的详细信息,以帮助我们重现问题,以及您的清单文件,您整合广告的活动以及指向您应用的链接在游戏市场/ apk文件。