0

こんにちは、私はアンドロイド開発の初心者です。次のエラーが表示されます。助けてください。前もって感謝します

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 に変更して新しいプロジェクトを開始した後、アプリは問題なく動作しています。

4

2 に答える 2

1

マニフェスト ファイルでアクティビティ名のスペルを確認してください。間違っています。Gossipmateの代わりにする必要がありGossipMateます。

アップデート

android:name="com.example.gossipmate.mobi.Gossipmate"代わりにこの行をマニフェストに入れてみてください android:name=".GossipMate"

于 2012-11-05T09:12:51.797 に答える
0

あなたAndroidManifest.xml.のアクティビティの名前は、android:name=".GossipMate"仲間mの大文字で、アクティビティのどこにGossipmate!!!

java.lang.RuntimeException を確認してください: アクティビティ ComponentInfo をインスタンス化できません

于 2012-11-05T08:39:42.067 に答える