Android 创建应用程序类以设置Parse.com推送通知后,应用程序在启动时崩溃

Android 创建应用程序类以设置Parse.com推送通知后,应用程序在启动时崩溃,android,parse-platform,push-notification,Android,Parse Platform,Push Notification,我将遵循本教程启用解析推送通知 我还下载了代码并在我自己的应用程序中使用。但它会导致应用程序在启动时崩溃,我不知道为什么 以下是我的应用程序类代码: public class Application extends android.app.Application { public Application() { } @Override public void onCreate() { super.onCreate(); // Initialize the P

我将遵循本教程启用解析推送通知

我还下载了代码并在我自己的应用程序中使用。但它会导致应用程序在启动时崩溃,我不知道为什么

以下是我的应用程序类代码:

public class Application extends android.app.Application {

  public Application() {
  }

  @Override
  public void onCreate() {
    super.onCreate();

    // Initialize the Parse SDK.
    Parse.initialize(this, "My_APP_ID", "My_CLIENT_KEY");

    // Specify an Activity to handle all pushes by default.
    PushService.setDefaultPushCallback(this, MainActivity.class);
  }
}
当我删除与解析相关的最后两行时,我的应用程序工作正常。你能帮帮我吗

这是logcat输出:

     --------- beginning of /dev/log/main
05-28 12:24:44.755    2638-2638/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
05-28 12:24:44.765    2638-2638/? D/AndroidRuntime﹕ CheckJNI is OFF
05-28 12:24:44.765    2638-2638/? D/dalvikvm﹕ Trying to load lib libjavacore.so 0x0
05-28 12:24:44.765    2638-2638/? D/dalvikvm﹕ Added shared lib libjavacore.so 0x0
05-28 12:24:44.765    2638-2638/? D/dalvikvm﹕ Trying to load lib libnativehelper.so 0x0
05-28 12:24:44.765    2638-2638/? D/dalvikvm﹕ Added shared lib libnativehelper.so 0x0
05-28 12:24:44.765    2638-2638/? D/dalvikvm﹕ No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
05-28 12:24:44.775    2638-2638/? D/dalvikvm﹕ Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
05-28 12:24:44.845    2638-2638/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory)
05-28 12:24:44.845    2638-2638/? E/android.os.Debug﹕ failed to load memtrack module: -2
05-28 12:24:44.865    2638-2638/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
    --------- beginning of /dev/log/system
05-28 12:24:44.865    1724-1815/system_process I/ActivityManager﹕ Force stopping com.example.adla.insurancemobileapplication appid=10066 user=0: from pid 2638
05-28 12:24:44.875    2638-2638/? D/AndroidRuntime﹕ Shutting down VM
05-28 12:24:44.875    2638-2645/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
05-28 12:24:44.875    2638-2647/? I/AndroidRuntime﹕ NOTE: attach of thread 'Binder_1' failed
05-28 12:24:44.875    2638-2646/? E/cutils-trace﹕ Error opening trace file: No such file or directory (2)
05-28 12:24:44.875    1724-1739/system_process I/ActivityManager﹕ Setting mBooting value to false, currently mBooted = true
05-28 12:24:45.135    2658-2658/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
05-28 12:24:45.135    2658-2658/? D/AndroidRuntime﹕ CheckJNI is OFF
05-28 12:24:45.145    2658-2658/? D/dalvikvm﹕ Trying to load lib libjavacore.so 0x0
05-28 12:24:45.145    2658-2658/? D/dalvikvm﹕ Added shared lib libjavacore.so 0x0
05-28 12:24:45.155    2658-2658/? D/dalvikvm﹕ Trying to load lib libnativehelper.so 0x0
05-28 12:24:45.155    2658-2658/? D/dalvikvm﹕ Added shared lib libnativehelper.so 0x0
05-28 12:24:45.155    2658-2658/? D/dalvikvm﹕ No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
05-28 12:24:45.165    2658-2658/? D/dalvikvm﹕ Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
05-28 12:24:45.265    2658-2665/? E/cutils-trace﹕ Error opening trace file: No such file or directory (2)
05-28 12:24:45.305    2658-2658/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory)
05-28 12:24:45.305    2658-2658/? E/android.os.Debug﹕ failed to load memtrack module: -2
05-28 12:24:45.325    2658-2658/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
05-28 12:24:45.345    1724-1735/system_process I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.adla.insurancemobileapplication/.MainActivity} from pid 2658
05-28 12:24:45.345    1724-1735/system_process D/ActivityManager﹕ TopActivityInfo, pkgName: com.example.adla.insurancemobileapplication activityName: com.example.adla.insurancemobileapplication.MainActivity  bstSpecialAppKeyboardHandlingEnabled = false
05-28 12:24:45.345    1917-1917/com.bluestacks.appguidance D/GuidanceScreen﹕ event === app_launch
05-28 12:24:45.345    1917-1917/com.bluestacks.appguidance D/GuidanceScreen﹕ hiding guidance
05-28 12:24:45.345    1917-1917/com.bluestacks.appguidance D/GuidanceScreen﹕ hardKeyboard = 1
05-28 12:24:45.345    1917-1917/com.bluestacks.appguidance D/GuidanceScreen﹕ controllerType === DualAction
05-28 12:24:45.345    1917-1917/com.bluestacks.appguidance D/GuidanceScreen﹕ appName: InsuranceMobileApplication, currentPkg: com.example.adla.insurancemobileapplication, event: app_launch, controller: DualAction
05-28 12:24:45.345    1917-1917/com.bluestacks.appguidance D/GuidanceScreen﹕ appName: InsuranceMobileApplication
05-28 12:24:45.345    1724-1735/system_process D/ActivityManager﹕ Showing guidance for pkgName: com.example.adla.insurancemobileapplication
05-28 12:24:45.355    2658-2658/? D/AndroidRuntime﹕ Shutting down VM
05-28 12:24:45.355    2658-2665/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
05-28 12:24:45.355    1917-1917/com.bluestacks.appguidance D/GuidanceScreen﹕ no guidance for com.example.adla.insurancemobileapplication.
05-28 12:24:45.355    2669-2669/? D/dalvikvm﹕ Late-enabling CheckJNI
05-28 12:24:45.375    2669-2675/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
05-28 12:24:45.375    1724-1913/system_process I/ActivityManager﹕ Start proc com.example.adla.insurancemobileapplication for activity com.example.adla.insurancemobileapplication/.MainActivity: pid=2669 uid=10066 gids={50066, 3003}
05-28 12:24:45.395    2031-2031/com.bluestacks.home D/Home.AppLaunchReceiver﹕ *************************Received app launch broadcast
05-28 12:24:45.395    2031-2031/com.bluestacks.home D/Home.AppLaunchReceiver﹕ APP LAUNCH com.example.adla.insurancemobileapplication
05-28 12:24:45.435    1724-1743/system_process D/WindowManager﹕ Sending appClickStats request with data: [package=com.example.adla.insurancemobileapplication, appname=InsuranceMobileApplication, appver=1.0, clickloc=system_server]
05-28 12:24:45.455    2669-2669/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
05-28 12:24:45.455    2669-2669/? W/dalvikvm﹕ VFY: unable to resolve virtual method 452: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
05-28 12:24:45.455    2669-2669/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.455    2669-2669/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
05-28 12:24:45.455    2669-2669/? W/dalvikvm﹕ VFY: unable to resolve virtual method 474: Landroid/content/res/TypedArray;.getType (I)I
05-28 12:24:45.455    2669-2669/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.465    2669-2669/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawable
05-28 12:24:45.465    2669-2669/? W/dalvikvm﹕ VFY: unable to resolve virtual method 415: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
05-28 12:24:45.465    2669-2669/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.465    2669-2669/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawableForDensity
05-28 12:24:45.465    2669-2669/? W/dalvikvm﹕ VFY: unable to resolve virtual method 417: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
05-28 12:24:45.465    2669-2669/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.465    2669-2669/? D/AndroidRuntime﹕ Shutting down VM
05-28 12:24:45.465    2669-2669/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x95d30b20)
05-28 12:24:45.475    2669-2669/? D/AndroidRuntime﹕ procName from cmdline: com.example.adla.insurancemobileapplication
05-28 12:24:45.475    2669-2669/? E/AndroidRuntime﹕ in writeCrashedAppName, pkgName :com.example.adla.insurancemobileapplication
05-28 12:24:45.495    2669-2672/? D/dalvikvm﹕ GC_CONCURRENT freed 324K, 18% free 3063K/3728K, paused 10ms+10ms, total 20ms
05-28 12:24:45.505    2669-2669/? D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 10ms
05-28 12:24:45.505    2669-2669/? I/Process﹕ Sending signal. PID: 2669 SIG: 9
05-28 12:24:45.505    1946-1996/com.bluestacks.BstCommandProcessor D/BstCommandProcessor-Application﹕ Application crash has been observed.
05-28 12:24:45.505    2669-2669/? D/AndroidRuntime﹕ file written successfully with content: com.example.adla.insurancemobileapplication StringBuffer : ;com.example.adla.insurancemobileapplication
05-28 12:24:45.505    2669-2669/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.adla.insurancemobileapplication, PID: 2669
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.adla.insurancemobileapplication/com.example.adla.insurancemobileapplication.MainActivity}: java.lang.IllegalStateException: `Parse#enableLocalDatastore(Context)` must be invoked before `Parse#initialize(Context)`
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5021)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: `Parse#enableLocalDatastore(Context)` must be invoked before `Parse#initialize(Context)`
            at com.parse.Parse.enableLocalDatastore(Parse.java:65)
            at com.example.adla.insurancemobileapplication.MainActivity.onCreate(MainActivity.java:48)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5021)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
            at dalvik.system.NativeStart.main(Native Method)
05-28 12:24:45.505    1724-1735/system_process I/ActivityManager﹕ Process com.example.adla.insurancemobileapplication (pid 2669) has died.
05-28 12:24:45.515    2689-2689/? D/dalvikvm﹕ Late-enabling CheckJNI
05-28 12:24:45.525    1724-1735/system_process I/ActivityManager﹕ Start proc com.example.adla.insurancemobileapplication for activity com.example.adla.insurancemobileapplication/.MainActivity: pid=2689 uid=10066 gids={50066, 3003}
05-28 12:24:45.635    2689-2689/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
05-28 12:24:45.635    2689-2689/? W/dalvikvm﹕ VFY: unable to resolve virtual method 452: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
05-28 12:24:45.635    2689-2689/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.635    2689-2689/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
05-28 12:24:45.635    2689-2689/? W/dalvikvm﹕ VFY: unable to resolve virtual method 474: Landroid/content/res/TypedArray;.getType (I)I
05-28 12:24:45.635    2689-2689/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.645    2689-2692/? D/dalvikvm﹕ GC_CONCURRENT freed 454K, 20% free 3016K/3728K, paused 10ms+0ms, total 40ms
05-28 12:24:45.645    2689-2689/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawable
05-28 12:24:45.645    2689-2689/? W/dalvikvm﹕ VFY: unable to resolve virtual method 415: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
05-28 12:24:45.645    2689-2689/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.645    2689-2689/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawableForDensity
05-28 12:24:45.645    2689-2689/? W/dalvikvm﹕ VFY: unable to resolve virtual method 417: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
05-28 12:24:45.645    2689-2689/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.645    2689-2689/? D/AndroidRuntime﹕ Shutting down VM
05-28 12:24:45.645    2689-2689/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x95d30b20)
05-28 12:24:45.645    1946-1996/com.bluestacks.BstCommandProcessor D/BstCommandProcessor-Application﹕ Application crash has been observed.
05-28 12:24:45.645    2689-2689/? I/Process﹕ Sending signal. PID: 2689 SIG: 9
05-28 12:24:45.645    2689-2689/? D/AndroidRuntime﹕ procName from cmdline: com.example.adla.insurancemobileapplication
05-28 12:24:45.645    2689-2689/? E/AndroidRuntime﹕ in writeCrashedAppName, pkgName :com.example.adla.insurancemobileapplication
05-28 12:24:45.645    2689-2689/? D/AndroidRuntime﹕ file written successfully with content: com.example.adla.insurancemobileapplication StringBuffer : ;com.example.adla.insurancemobileapplication
05-28 12:24:45.645    2689-2689/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.adla.insurancemobileapplication, PID: 2689
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.adla.insurancemobileapplication/com.example.adla.insurancemobileapplication.MainActivity}: java.lang.IllegalStateException: `Parse#enableLocalDatastore(Context)` must be invoked before `Parse#initialize(Context)`
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5021)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: `Parse#enableLocalDatastore(Context)` must be invoked before `Parse#initialize(Context)`
            at com.parse.Parse.enableLocalDatastore(Parse.java:65)
            at com.example.adla.insurancemobileapplication.MainActivity.onCreate(MainActivity.java:48)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5021)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
            at dalvik.system.NativeStart.main(Native Method)
05-28 12:24:45.655    2727-2727/? D/dalvikvm﹕ Late-enabling CheckJNI
05-28 12:24:45.655    1724-1909/system_process I/ActivityManager﹕ Process com.example.adla.insurancemobileapplication (pid 2689) has died.
05-28 12:24:45.675    1724-1909/system_process I/ActivityManager﹕ Start proc com.example.adla.insurancemobileapplication for activity com.example.adla.insurancemobileapplication/.MainActivity: pid=2727 uid=10066 gids={50066, 3003}
05-28 12:24:45.705    2727-2727/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
05-28 12:24:45.705    2727-2727/? W/dalvikvm﹕ VFY: unable to resolve virtual method 452: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
05-28 12:24:45.705    2727-2727/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.705    2727-2727/? I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
05-28 12:24:45.705    2727-2727/? W/dalvikvm﹕ VFY: unable to resolve virtual method 474: Landroid/content/res/TypedArray;.getType (I)I
05-28 12:24:45.705    2727-2727/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.725    2727-2731/? D/dalvikvm﹕ GC_CONCURRENT freed 433K, 25% free 2826K/3728K, paused 10ms+0ms, total 10ms
05-28 12:24:45.735    2727-2727/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawable
05-28 12:24:45.735    2727-2727/? W/dalvikvm﹕ VFY: unable to resolve virtual method 415: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
05-28 12:24:45.735    2727-2727/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.735    2727-2727/? I/dalvikvm﹕ Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.internal.widget.ResourcesWrapper.getDrawableForDensity
05-28 12:24:45.735    2727-2727/? W/dalvikvm﹕ VFY: unable to resolve virtual method 417: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
05-28 12:24:45.735    2727-2727/? D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
05-28 12:24:45.745    2727-2727/? D/AndroidRuntime﹕ Shutting down VM
05-28 12:24:45.745    2727-2727/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x95d30b20)
05-28 12:24:45.745    1946-1996/com.bluestacks.BstCommandProcessor D/BstCommandProcessor-Application﹕ Application crash has been observed.
05-28 12:24:45.745    2727-2727/? I/Process﹕ Sending signal. PID: 2727 SIG: 9
05-28 12:24:45.745    2727-2727/? D/AndroidRuntime﹕ procName from cmdline: com.example.adla.insurancemobileapplication
05-28 12:24:45.745    2727-2727/? E/AndroidRuntime﹕ in writeCrashedAppName, pkgName :com.example.adla.insurancemobileapplication
05-28 12:24:45.745    2727-2727/? D/AndroidRuntime﹕ file written successfully with content: com.example.adla.insurancemobileapplication StringBuffer : ;com.example.adla.insurancemobileapplication
05-28 12:24:45.745    2727-2727/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.adla.insurancemobileapplication, PID: 2727
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.adla.insurancemobileapplication/com.example.adla.insurancemobileapplication.MainActivity}: java.lang.IllegalStateException: `Parse#enableLocalDatastore(Context)` must be invoked before `Parse#initialize(Context)`
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5021)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: `Parse#enableLocalDatastore(Context)` must be invoked before `Parse#initialize(Context)`
            at com.parse.Parse.enableLocalDatastore(Parse.java:65)
            at com.example.adla.insurancemobileapplication.MainActivity.onCreate(MainActivity.java:48)
            at android.app.Activity.performCreate(Activity.java:5231)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
            at android.app.ActivityThread.access$800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5021)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
            at dalvik.system.NativeStart.main(Native Method)
05-28 12:24:45.755    1724-1914/system_process I/ActivityManager﹕ Process com.example.adla.insurancemobileapplication (pid 2727) has died.
05-28 12:24:45.755    1724-1914/system_process W/ActivityManager﹕ Force removing ActivityRecord{4b263638 u0 com.example.adla.insurancemobileapplication/.MainActivity t11}: app died, no saved state
-----------开始/dev/log/main
05-28 12:24:44.755    2638-2638/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime启动com.android.internal.os.RuntimeInit
原因:java.lang.IllegalStateException:
必须先调用
Parse#enableLocalDatastore(上下文)
Parse#初始化(上下文)

似乎您只需要遵循例外情况的建议:

@Override
public void onCreate() {
    super.onCreate();

    Parse.enableLocalDatastore(this);

    // Initialize the Parse SDK.
    Parse.initialize(this, "My_APP_ID", "My_CLIENT_KEY");

    // Specify an Activity to handle all pushes by default.
    PushService.setDefaultPushCallback(this, MainActivity.class);
}

你能发布你的logcat输出吗请在更新的问题中检查它。你在清单中声明了PushService吗?是的,我按照完整的教程设置清单文件这3行日志对我们没有帮助。我以前尝试过,但我没有工作。我现在再次尝试,但仍然不工作可能会有不同的崩溃日志如何获取此日志我的意思是,通过调用enableLocalDatastore,如果它仍然不工作,可能还有其他问题,logcat将为新的崩溃提供不同的堆栈跟踪。