我的应用由于活动错误导致崩溃我无法识别

时间:2015-07-01 00:49:30

标签: java android eclipse android-activity

这是我一直试图制作的应用程序,但是当我尝试运行它时崩溃... LogCat上的大多数错误都表明存在“java.lang.RuntimeException:无法实例化活动ComponentInfo {com.greed / com.greed.GreedActivity}“这是我的清单文件,我做错了什么。

P.S。我正在使用eclipse,我还没有迁移到Android Studio。

我的完整LogCat就是这样:

07-01 10:31:57.823: D/AndroidRuntime(3536): Shutting down VM
07-01 10:31:57.823: W/dalvikvm(3536): threadid=1: thread exiting with uncaught exception (group=0x416b5d40)
07-01 10:31:57.834: E/AndroidRuntime(3536): FATAL EXCEPTION: main
07-01 10:31:57.834: E/AndroidRuntime(3536): Process: com.greed, PID: 3536
07-01 10:31:57.834: E/AndroidRuntime(3536): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.greed/com.greed.GreedActivity}: java.lang.ClassNotFoundException: Didn't find class "com.greed.GreedActivity" on path: DexPathList[[zip file "/data/app/com.greed-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.greed-1, /vendor/lib, /system/lib]]
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2135)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.app.ActivityThread.access$800(ActivityThread.java:139)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.os.Handler.dispatchMessage(Handler.java:102)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.os.Looper.loop(Looper.java:136)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.app.ActivityThread.main(ActivityThread.java:5102)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at java.lang.reflect.Method.invokeNative(Native Method)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at java.lang.reflect.Method.invoke(Method.java:515)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at dalvik.system.NativeStart.main(Native Method)
07-01 10:31:57.834: E/AndroidRuntime(3536): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.greed.GreedActivity" on path: DexPathList[[zip file "/data/app/com.greed-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.greed-1, /vendor/lib, /system/lib]]
07-01 10:31:57.834: E/AndroidRuntime(3536):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.app.Instrumentation.newActivity(Instrumentation.java:1084)
07-01 10:31:57.834: E/AndroidRuntime(3536):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2126)
07-01 10:31:57.834: E/AndroidRuntime(3536):     ... 11 more
07-01 10:32:02.763: I/Process(3536): Sending signal. PID: 3536 SIG: 9

清单:

<manifest package="com.greed"
    android:versionCode="1"
    android:versionName="1.0"
    android:installLocation="preferExternal"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".GreedActivity"
            android:label="Greed"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

1 个答案:

答案 0 :(得分:1)

您没有名为GreedActivity的类,它是您的启动器

或清单文件中的包不正确