大家好,我是android开发的新手,我收到以下错误有什么帮助吗?提前致谢
package com.example.gossipmate.mobi;
import android.os.Bundle;
import android.app.Activity;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class Gossipmate extends Activity
{
final Activity activity = this;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.activity_gossip_mate);
final WebView webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
activity.setTitle("Loading");
activity.setProgress(progress * 100);
if (progress == 100)
activity.setTitle(R.string.app_name);
}
});
webView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
// Handle the error
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl("http://www.gossipmate.x10.bz");
}}
以上是我的应用程序的代码,错误如下所示
11-05 13:34:06.329: W/dalvikvm(595): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-05 13:34:06.429: E/AndroidRuntime(595): FATAL EXCEPTION: main
11-05 13:34:06.429: E/AndroidRuntime(595): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.gossipmate.mobi/com.example.gossipmate.mobi.GossipMate}: java.lang.ClassNotFoundException: com.example.gossipmate.mobi.GossipMate in loader dalvik.system.PathClassLoader[/data/app/com.example.gossipmate.mobi-1.apk]
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.os.Handler.dispatchMessage(Handler.java:99)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.os.Looper.loop(Looper.java:123)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.reflect.Method.invokeNative(Native Method)
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.reflect.Method.invoke(Method.java:507)
11-05 13:34:06.429: E/AndroidRuntime(595): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-05 13:34:06.429: E/AndroidRuntime(595): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-05 13:34:06.429: E/AndroidRuntime(595): at dalvik.system.NativeStart.main(Native Method)
11-05 13:34:06.429: E/AndroidRuntime(595): Caused by: java.lang.ClassNotFoundException: com.example.gossipmate.mobi.GossipMate in loader dalvik.system.PathClassLoader[/data/app/com.example.gossipmate.mobi-1.apk]
11-05 13:34:06.429: E/AndroidRuntime(595): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
11-05 13:34:06.429: E/AndroidRuntime(595): ... 11 more
11-05 13:34:06.539: W/ActivityManager(61): Force finishing activity com.example.gossipmate.mobi/.GossipMate
11-05 13:34:07.109: W/ActivityManager(61): Activity pause timeout for HistoryRecord{406d08c8 com.example.gossipmate.mobi/.GossipMate}
清单文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gossipmate.mobi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".GossipMate"
android:label="@string/title_activity_gossip_mate" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
以上是我正在使用的清单代码我确定我已经注册了活动
在我用 m 更改 M 并开始一个新项目后,该应用程序现在可以正常运行。