当我尝试运行我的应用程序时,启动画面正确出现,并且在它关闭后立即弹出一条消息,上面写着“不幸的是,第一个应用程序已停止工作”我尝试了很多不同的解决方案,但我发现我相信在我的情况下,在模拟器中测试新的“Hello World”应用程序后,我的代码有问题。这是我的 androidmanifest.xml 的副本
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.examle.firstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Splash" android:label="@string/app_name" >
<intent-filter>
<action android:name="com.example.firstapp.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity" android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAINACTIVTY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
这是尝试一些解决方案后出现在 log cat 中的内容
06-08 16:12:06.849: E/AndroidRuntime(2821): FATAL EXCEPTION: main
06-08 16:12:06.849: E/AndroidRuntime(2821): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.firstapp/com.example.firstapp.Splash}: java.lang.ClassNotFoundException: Didn't find class "com.example.firstapp.Splash" on path: /data/app/com.example.firstapp-1.apk
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.os.Looper.loop(Looper.java:137)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-08 16:12:06.849: E/AndroidRuntime(2821): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 16:12:06.849: E/AndroidRuntime(2821): at java.lang.reflect.Method.invoke(Method.java:511)
06-08 16:12:06.849: E/AndroidRuntime(2821): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-08 16:12:06.849: E/AndroidRuntime(2821): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-08 16:12:06.849: E/AndroidRuntime(2821): at dalvik.system.NativeStart.main(Native Method)
06-08 16:12:06.849: E/AndroidRuntime(2821): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.firstapp.Splash" on path: /data/app/com.example.firstapp-1.apk
06-08 16:12:06.849: E/AndroidRuntime(2821): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
06-08 16:12:06.849: E/AndroidRuntime(2821): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-08 16:12:06.849: E/AndroidRuntime(2821): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-08 16:12:06.849: E/AndroidRuntime(2821): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
06-08 16:12:06.849: E/AndroidRuntime(2821): ... 11 more
我对android编程真的很陌生,所以如果你在帮助我时能具体一点,将不胜感激。