0

我的应用程序不断崩溃,我不知道出了什么问题。我只是在应用程序中添加了一个新包

下面的代码是我的 logcat 错误输出

01-07 07:28:51.824: E/AndroidRuntime(471): FATAL EXCEPTION: main
01-07 07:28:51.824: E/AndroidRuntime(471): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.coverflow/com.coverflow.CoverFlowExample}: java.lang.ClassNotFoundException: com.coverflow.CoverFlowExample in loader dalvik.system.PathClassLoader[/data/app/com.example.coverflow-2.apk]
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1739)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.app.ActivityThread.access$500(ActivityThread.java:122)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.os.Looper.loop(Looper.java:132)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.app.ActivityThread.main(ActivityThread.java:4123)
01-07 07:28:51.824: E/AndroidRuntime(471):  at java.lang.reflect.Method.invokeNative(Native Method)
01-07 07:28:51.824: E/AndroidRuntime(471):  at java.lang.reflect.Method.invoke(Method.java:491)
01-07 07:28:51.824: E/AndroidRuntime(471):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
01-07 07:28:51.824: E/AndroidRuntime(471):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
01-07 07:28:51.824: E/AndroidRuntime(471):  at dalvik.system.NativeStart.main(Native Method)
01-07 07:28:51.824: E/AndroidRuntime(471): Caused by: java.lang.ClassNotFoundException: com.coverflow.CoverFlowExample in loader dalvik.system.PathClassLoader[/data/app/com.example.coverflow-2.apk]
01-07 07:28:51.824: E/AndroidRuntime(471):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
01-07 07:28:51.824: E/AndroidRuntime(471):  at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
01-07 07:28:51.824: E/AndroidRuntime(471):  at java.lang.ClassLoader.loadClass(ClassLoader.java:500)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.app.Instrumentation.newActivity(Instrumentation.java:1022)
01-07 07:28:51.824: E/AndroidRuntime(471):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1730)
01-07 07:28:51.824: E/AndroidRuntime(471):  ... 11 more

下面是我的android清单文件,我添加了活动意图

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.coverflow"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application 
        android:icon="@drawable/icon" 
        android:label="@string/app_name"
        android:largeHeap="true">
        <activity android:name="com.coverflow.CoverFlowExample"
            android:configChanges="orientation|keyboardHidden"
                  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.example.userguide"></activity>

    </application>
    <uses-sdk android:minSdkVersion="13" />
    <supports-screens android:anyDensity="true" />

</manifest> 
4

1 回答 1

2

您已经提供了您的包名称package="com.example.coverflow",并且您正在通过此名称访问您的活动android:name="com.coverflow.CoverFlowExample"。这里你忘记写了example,所以你的全名是错误的。

请改成这样:

android:name="com.example.coverflow.CoverFlowExample"

于 2013-01-07T07:37:50.360 回答