0

我是 android 的新手......我的项目是使用 parse.com 的通知项目......没有错误,但我的项目停止工作......

日志猫是

09-27 17:44:48.422: E/AndroidRuntime(947): FATAL EXCEPTION: main
09-27 17:44:48.422: E/AndroidRuntime(947): java.lang.RuntimeException: Unable to instantiate application com.parse.mech.ParseApplication: java.lang.ClassNotFoundException: Didn't find class "com.parse.mech.ParseApplication" on path: /data/app/com.parse.mech-2.apk
09-27 17:44:48.422: E/AndroidRuntime(947):  at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
09-27 17:44:48.422: E/AndroidRuntime(947):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364)
09-27 17:44:48.422: E/AndroidRuntime(947):  at android.app.ActivityThread.access$1300(ActivityThread.java:141)
09-27 17:44:48.422: E/AndroidRuntime(947):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
09-27 17:44:48.422: E/AndroidRuntime(947):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-27 17:44:48.422: E/AndroidRuntime(947):  at android.os.Looper.loop(Looper.java:137)
09-27 17:44:48.422: E/AndroidRuntime(947):  at android.app.ActivityThread.main(ActivityThread.java:5039)
09-27 17:44:48.422: E/AndroidRuntime(947):  at java.lang.reflect.Method.invokeNative(Native Method)
09-27 17:44:48.422: E/AndroidRuntime(947):  at java.lang.reflect.Method.invoke(Method.java:511)
09-27 17:44:48.422: E/AndroidRuntime(947):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-27 17:44:48.422: E/AndroidRuntime(947):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-27 17:44:48.422: E/AndroidRuntime(947):  at dalvik.system.NativeStart.main(Native Method)
09-27 17:44:48.422: E/AndroidRuntime(947): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.parse.mech.ParseApplication" on path: /data/app/com.parse.mech-2.apk
09-27 17:44:48.422: E/AndroidRuntime(947):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
09-27 17:44:48.422: E/AndroidRuntime(947):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-27 17:44:48.422: E/AndroidRuntime(947):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-27 17:44:48.422: E/AndroidRuntime(947):  at       android.app.Instrumentation.newApplication(Instrumentation.java:968)
  09-27 17:44:48.422: E/AndroidRuntime(947):    at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
 09-27 17:44:48.422: E/AndroidRuntime(947):     ... 11 more

这是我的 manifest.xml

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

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />

<application
    android:name="Mech"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".ParseStarterProjectActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <service android:name="com.parse.PushService" />

    <receiver android:name="com.parse.ParseBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
    </receiver>
</application>

笏是我必须在这方面做的改变.....提前谢谢

4

4 回答 4

0

com.parse.mech.ParseApplication

将此类添加到您的清单中。

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.parse.mech.ParseApplication" on path:    /data/app/com.parse.mech-2.apk
09-27 17:44:48.422: E/AndroidRuntime(947):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)

将此添加到您的清单中:

    <activity
        android:name=".ParseApplication"
        android:label="@string/app_name" >
    </activity>
于 2013-10-13T14:16:02.633 回答
0

我认为您忘记.在您的应用程序类名称之前添加

喜欢 name=.Mech

或者您可以添加完整路径

name = com.parse.mech.Mech 

还有这个

com.parse.mech.ParseStarterProjectActivity

你的清单应该是这样的

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

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />

<application
    android:name="com.parse.mech.Mech"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name="com.parse.mech.ParseStarterProjectActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <service android:name="com.parse.PushService" />

    <receiver android:name="com.parse.ParseBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
    </receiver>
</application>
于 2013-10-13T16:26:26.483 回答
0

:如果您在您的 android 名称前面加上句点包路径,则在您的 android 清单活动块中的路径:/data/app/com.parse.mech-2.apk 上找不到类“com.parse.mech.ParseApplication”将被附加,所以如果你有“.com.parse.mech2”,它会寻找“com.parse.com.parse.mech2”,所以要么删除句点,要么不给出全名。就像 Simon 说的,你可能会遇到编译时错误、链接时错误、运行时错误等。logcat 有帮助,学习运行调试器也有帮助。

于 2013-10-13T14:43:31.993 回答
0

当我从 Eclipse 运行应用程序并将其直接加载到我的手机并且在我的手机中应用程序已经在运行时,我收到此错误。所以,如果它对你来说是一样的,那么这不是问题。如果您想避免该错误,您可以尝试从手机/模拟器手动卸载该应用程序,然后再次尝试从 Eclipse 运行该项目。希望能帮助到你。

于 2013-10-13T14:42:29.907 回答