2014-03-24 92 views
0

我正在製作一個應用程序,其中有一個splash類,其中包含要在應用程序運行並且創建另一個類時顯示的圖像用於添加和減去一個數,它是圖像appered第一之後顯示....應用程序sati(process com.example.sati)已意外停止。請再試一次

的manifest.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 
+0

你可以發佈SplashAct – Raghunandan

+0

的包名@Raghunandan它的包名融爲一體。 example.sati – user3431536

回答

0

您的清單要求有一個活動類SplashAct但你發佈的代碼只有Splash。確保清單和代碼具有相同的完整類名稱。

1
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" 
+0

它w orked !!!!! :) – user3431536

+0

但爲什麼我無法理解Logcat中顯示的錯誤!我討厭它...... – user3431536

+0

@ user3431536看看由部分引起的':java.lang.ClassNotFoundException:com.example.sati.SplashAct in loader dalvik.system.PathClassLoader [/data/app/com.example .sati-1.apk]'。它說找不到Activity @'com.example.sati.SplashAct' – Raghunandan

相關問題