我是android的新手...... 我的项目是使用parse.com的通知项目... 没有错误,但我的项目停止了工作...
logcat是
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>
wat是我必须做的改变.....感谢提前
答案 0 :(得分: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>
答案 1 :(得分:0)
当我从Eclipse运行应用程序直接将应用程序加载到我的手机时,我得到此错误,而在我的手机中,应用程序已在运行。所以,如果它对你来说一样,那么这不是问题。如果要避免该错误,可以尝试从手机/模拟器手动卸载应用程序,然后再次尝试从Eclipse运行该项目。希望它有所帮助。
答案 2 :(得分:0)
:如果你的android名称前面有一个句点,你的android清单活动块中的路径:/data/app/com.parse.mech-2.apk上找不到类“com.parse.mech.ParseApplication”将附加包路径,因此如果您有“.com.parse.mech2”,它将查找“com.parse.com.parse.mech2”,因此要么删除句号,要么不提供全名。也像Simon说的那样你可能有编译时错误,链接时错误,运行时错误等.logcat有帮助,学习运行调试器也有帮助。
答案 3 :(得分:0)
我认为您忘记在申请的班级名称之前添加.
喜欢name=.Mech
或者您可以添加完整路径
name = com.parse.mech.Mech
和thi也是
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>