gpt4 book ai didi

Android 3.0 WebView 崩溃

转载 作者:行者123 更新时间:2023-12-03 16:55:51 25 4
gpt4 key购买 nike

嗨,我正在尝试为 android 3.0 API 11 构建一个带有 flash 的 webview,我已经寻找了几天的解决方案,但可以找到任何有用的东西,我不知道问题出在哪里..?当我启动它时,它在模拟器上崩溃!请帮忙! :(

错误代码

03-26 00:26:47.747: ERROR/AndroidRuntime(637): FATAL EXCEPTION: main
03-26 00:26:47.747: ERROR/AndroidRuntime(637): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{xxxxx.com.xxxxx/xxxxx.com.xxxxx.xxxxxctivity}: java.lang.ClassNotFoundException: xxxxxx.com.xxxxx.xxxxxActivity in loader dalvik.system.PathClassLoader[/data/app/xxxxxx.com.xxxxxxvol-2.apk]
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.os.Handler.dispatchMessage(Handler.java:99)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.os.Looper.loop(Looper.java:126)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.app.ActivityThread.main(ActivityThread.java:3997)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at java.lang.reflect.Method.invokeNative(Native Method)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at java.lang.reflect.Method.invoke(Method.java:491)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at dalvik.system.NativeStart.main(Native Method)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): Caused by: java.lang.ClassNotFoundException: xxxxx.com.xxxxx.xxxxxxctivity in loader dalvik.system.PathClassLoader[/data/app/xxxxxxx.com.xxxxxxxx-2.apk]
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at java.lang.ClassLoader.loadClass(ClassLoader.java:548)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at java.lang.ClassLoader.loadClass(ClassLoader.java:508)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-26 00:26:47.747: ERROR/AndroidRuntime(637): ... 11 more

JAVA代码
package xxxxx.com.xxxxx;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebSettings.PluginState;

import com.google.ads.AdRequest;
import com.google.ads.AdView;


public class DemoriginalActivity extends Activity {
private static final String WebSettings = null;
/** Called when the activity is first created. */
private WebView webview;



@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

AdView adview = (AdView)findViewById(R.id.ad);

AdRequest re = new AdRequest();
re.setTesting(true);
adview.loadAd(re);

webview = (WebView) findViewById(R.id.webview1);

// workaround so that the default browser doesn't take over
//Compile error: MyWebViewClient cannot be resolved to a type
webview.setWebViewClient(new WebViewClient());
webview.getSettings().setPluginsEnabled(true);
webview.getSettings().setPluginState(PluginState.ON);

webview.getSettings().setBuiltInZoomControls(true);

webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://google.com/");

}



public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
webview.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}



public static String getWebsettings() {
return WebSettings;
}
}

主要 XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:keepScreenOn="true"
>

<WebView android:id="@+id/webview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text = "Hello, world!"
android:keepScreenOn="true"
/>


<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.ads.AdView
ads:adUnitId="xxxxxxxxxxx"
ads:adSize="BANNER"
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>

最佳答案

您的 list ( xxxxx.com.xxxxx.xxxxxxctivity ) 中列出了您尝试启动的 Activity ,但您的项目中不存在此类。

关于Android 3.0 WebView 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9864912/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com