-1

これは Android マニフェストです。

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="11" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/pic"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.thenewboaton.travis.abc"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

         <activity
            android:name="com.thenewboaton.traivs.splash"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.thenewboaton.Splash" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    </application>

</manifest>

MainActivity という名前の Main Java クラス:

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




    public class MainActivity extends Activity {

        int counter;
        Button add;
        Button sub;
        TextView display;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.splash);
            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() {


                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    counter++;      
                    display.setText("Your total is "+counter);

                }
            });

            sub.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    counter--;
                    display.setText("Your total is "+counter);

                }

             });


        }//method
    }//class

    Finally the logcat:

06-17 18:51:51.427: E/AndroidRuntime(358): FATAL EXCEPTION: main
06-17 18:51:51.427: E/AndroidRuntime(358): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.thenewboaton.travis/com.thenewboaton.travis.abc}: java.lang.ClassNotFoundException: com.thenewboaton.travis.abc in loader dalvik.system.PathClassLoader[/data/app/com.thenewboaton.travis-1.apk]
06-17 18:51:51.427: E/AndroidRuntime(358):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660)

だから私はあちこちでクラス名とアクティビティ名を変えてみました。エミュレーターが起動するとすぐに、ランチャーが失敗し、アプリがまったく起動しないというエラーが表示されます..このエラーが発生する前に行った正確な変更を思い出せません..誰かが私を助けてくれますか? 誰かがこれを理解できれば幸いです。ありがとう :)

4

2 に答える 2

-1

マニフェストは「abc」と「splash」の 2 つのアクティビティを指していますが、ソース コードは MainActivity と呼ばれています。MainActivity を abc に変更するか、abc ではなく MainActivity を指すようにマニフェストを編集します。

于 2013-06-17T13:38:39.623 に答える