2

私の申請はエミュレータで終了します。何をすべきか?私の Java コードは、私の xml に正しく基づいています。

Java コード:-

package com.thenewboston.parin;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class StartingPoint extends Activity {
    int counter;
    Button add, sub;
    TextView display;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_starting_point);
        counter = 0;
        add = (Button) findViewById(R.id.bAdd);
        sub = (Button) findViewById(R.id.bSub);
        display = (TextView) findViewById(R.id.tvDisplay);

        add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                counter += 1;
                display.setText("Your total is" + counter);
            }
        });

        sub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                counter--;
                display.setText("Your total is" + counter);
            }
        });
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // inflate menu
        getMenuInflater().inflate(R.menu.starting_point, menu);
        return true;
    }
}

およびエラーメッセージ:-

 07-23 12:43:33.375: D/AndroidRuntime(395): Shutting down VM 07-23 12:43:33.375: W/dalvikvm(395): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 07-23 12:43:33.375: E/AndroidRuntime(395): FATAL EXCEPTION: main 07-23 12:43:33.375: E/AndroidRuntime(395): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.thenewboston.parin/com.thenewboston.parin.Startingpoint}: java.lang.ClassNotFoundException: com.thenewboston.parin.Startingpoint in loader dalvik.system.PathClassLoader[/data/app/com.thenewboston.parin-2.apk] 07-23 12:43:33.375: E/AndroidRuntime(395): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.os.Handler.dispatchMessage(Handler.java:99) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.os.Looper.loop(Looper.java:123) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.app.ActivityThread.main(ActivityThread.java:4627) 07-23 12:43:33.375: E/AndroidRuntime(395): at java.lang.reflect.Method.invokeNative(Native Method) 07-23 12:43:33.375: E/AndroidRuntime(395): at java.lang.reflect.Method.invoke(Method.java:521) 07-23 12:43:33.375: E/AndroidRuntime(395): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 07-23 12:43:33.375: E/AndroidRuntime(395): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 07-23 12:43:33.375: E/AndroidRuntime(395): at dalvik.system.NativeStart.main(Native Method) 07-23 12:43:33.375: E/AndroidRuntime(395): Caused by: java.lang.ClassNotFoundException: com.thenewboston.parin.Startingpoint in loader dalvik.system.PathClassLoader[/data/app/com.thenewboston.parin-2.apk] 07-23 12:43:33.375: E/AndroidRuntime(395): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 07-23 12:43:33.375: E/AndroidRuntime(395): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 07-23 12:43:33.375: E/AndroidRuntime(395): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 07-23 12:43:33.375: E/AndroidRuntime(395): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577) 07-23 12:43:33.375: E/AndroidRuntime(395): ... 11 more 07-23 12:45:27.575: I/Process(395): Sending signal. PID: 395 SIG: 9
4

1 に答える 1

1

マニフェストの変更で

<activity android:name="com.thenewboston.parin.Startingpoint" android:label="@string/app_name" >

<activity android:name="com.thenewboston.parin.StartingPoint" android:label="@string/app_name" >

タイプミスがありました。大文字は重要です。

于 2013-07-23T07:47:20.123 に答える