gpt4 book ai didi

java - 应用程序 sati(进程 com.example.sati)意外停止。请重试

转载 作者:行者123 更新时间:2023-12-01 13:13:56 25 4
gpt4 key购买 nike

我正在制作一个应用程序,其中有一个启动类,其中包含要在应用程序运行时显示的图像,另一个类用于添加和减去数字,并且将在图像首先出现后显示。 ...

ma​​nifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sati"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />// here shows a warning saying"Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details."

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".SplashAct"
//it's the class 'splash' containing an image that shows up on start of an app
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=".MainActivity"//it's a class that will appear after 'splash class'
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.example.sati.MAINACTIVITY" />

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

</manifest>
following is the code of xml file named splash
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/splash">
</LinearLayout>

Splash.java

package com.example.sati;

import android.app.Activity;

import android.os.Bundle;

public class Splash extends Activity {

@Override
protected void onCreate(Bundle sidra) {
// TODO Auto-generated method stub
super.onCreate(sidra);
setContentView(R.layout.splash);//SPLASH CLASS CODE


}

}

//all above mentioned code is the implementation of ThenewBoston tutorials up to 14

Logcat

    03-24 13:26:23.285: W/dalvikvm(328): threadid=1: thread exiting with uncaught exception    (group=0x4001d800)
03-24 13:26:23.355: E/AndroidRuntime(328): FATAL EXCEPTION: main
03-24 13:26:23.355: E/AndroidRuntime(328): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.sati/com.example.sati.SplashAct}: java.lang.ClassNotFoundException: com.example.sati.SplashAct in loader dalvik.system.PathClassLoader[/data/app/com.example.sati-1.apk]
03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.os.Handler.dispatchMessage(Handler.java:99)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.os.Looper.loop(Looper.java:123)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread.main(ActivityThread.java:4 627)
03-24 13:26:23.355: E/AndroidRuntime(328): at java.lang.reflect.Method.invokeNative(Native Method)
03-24 13:26:23.355: E/AndroidRuntime(328): at java.lang.reflect.Method.invoke(Method.java:521)
03-24 13:26:23.355: E/AndroidRuntime(328): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-24 13:26:23.355: E/AndroidRuntime(328): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-24 13:26:23.355: E/AndroidRuntime(328): at dalvik.system.NativeStart.main(Native Method)
03-24 13:26:23.355: E/AndroidRuntime(328): Caused by: java.lang.ClassNotFoundException: com.example.sati.SplashAct in loader dalvik.system.PathClassLoader[/data/app/com.example.sati-1.apk]
03-24 13:26:23.355: E/AndroidRuntime(328): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-24 13:26:23.355: E/AndroidRuntime(328): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-24 13:26:23.355: E/AndroidRuntime(328): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-24 13:26:23.355: E/AndroidRuntime(328): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-24 13:26:23.355: E/AndroidRuntime(328): ... 11 more

最佳答案

Caused by: java.lang.ClassNotFoundException: com.example.sati.SplashAct

你有

public class Splash extends Activity { // Activity Name is Splash not SplashAct

所以改变这个

<activity
android:name=".SplashAct"

<activity
android:name=".Splash"

关于java - 应用程序 sati(进程 com.example.sati)意外停止。请重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22610825/

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