这是我的两个班级和我的清单。我有一个ClassNotFoundException
. 我还包括了我的日志猫。
我的第一堂课:
package com.m.mech;
import com.parse.Parse;
import com.parse.ParseACL;
import com.parse.ParseUser;
import android.app.Application;
public class ParsePro extends Application {
@Override
public void onCreate() {
super.onCreate();
// Add your initialization code here
Parse.initialize(this,"tadjgdfghdfgdfdfcfgdfcr", "QlwkikEQCXZ8cW9ghjwbFpXjAaWEr5Js6H2Cud5");
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// If you would like all objects to be private by default, remove this line.
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
我的第二堂课:
package com.m.mech;
import com.m.mech.R;
import android.app.Activity;
import android.os.Bundle;
import com.parse.ParseAnalytics;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpened(getIntent());
}
}
我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.m.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.m.mech.ParsePro"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name="com.parse.mech.MainActivity"
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>
</manifest>
我的日志猫:
10-15 14:59:36.168: E/AndroidRuntime(1114): FATAL EXCEPTION: main
10-15 14:59:36.168: E/AndroidRuntime(1114): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.m.mech/com.parse.mech.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.parse.mech.MainActivity" on path: /data/app/com.m.mech-2.apk
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.os.Handler.dispatchMessage(Handler.java:99)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.os.Looper.loop(Looper.java:137)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.app.ActivityThread.main(ActivityThread.java:5039)
10-15 14:59:36.168: E/AndroidRuntime(1114): at java.lang.reflect.Method.invokeNative(Native Method)
10-15 14:59:36.168: E/AndroidRuntime(1114): at java.lang.reflect.Method.invoke(Method.java:511)
10-15 14:59:36.168: E/AndroidRuntime(1114): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-15 14:59:36.168: E/AndroidRuntime(1114): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-15 14:59:36.168: E/AndroidRuntime(1114): at dalvik.system.NativeStart.main(Native Method)
10-15 14:59:36.168: E/AndroidRuntime(1114): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.parse.mech.MainActivity" on path: /data/app/com.m.mech-2.apk
10-15 14:59:36.168: E/AndroidRuntime(1114): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
10-15 14:59:36.168: E/AndroidRuntime(1114): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-15 14:59:36.168: E/AndroidRuntime(1114): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
10-15 14:59:36.168: E/AndroidRuntime(1114): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
10-15 14:59:36.168: E/AndroidRuntime(1114): ... 11 more
10-15 14:59:47.998: E/Trace(1137): error opening trace file: No such file or directory (2)
为什么我会得到这个ClassNotFoundException
?