Reputation: 123
My app has two Activities, it works fine but once i put these lines of code
Parse.initialize(this, "app id", "client id");
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
The app crashes. I tried to delete it from the first activity and put it in the second activity, when i did this, the app works fine until the app moves to the second activity, it crashes then
04-21 17:37:59.199 22529-22529/com.example.cashmoney.barakah E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: bolts.Task
at com.parse.ParseInstallation.hasCurrentInstallationAsync(ParseInstallation.java:88)
at com.parse.GcmRegistrar.updateAsync(GcmRegistrar.java:96)
at com.parse.Parse.initialize(Parse.java:240)
at com.example.cashmoney.barakah.MainActivity.onCreate(MainActivity.java:42)
at android.app.Activity.performCreate(Activity.java:5193)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2189)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$600(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1259)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5166)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
at dalvik.system.NativeStart.main(Native Method)
Upvotes: 1
Views: 524
Reputation: 1743
It looks like you need to add a reference to the bolts library. If you're using gradle the following should work:
dependencies { compile 'com.parse.bolts:bolts-android:1.2.0' }
Upvotes: 0
Reputation: 5516
The Parse initialization should be placed in the onCreate Method of the Application class.
Parse.initialize(this, "APPLICATION ID",
"CLIENT KEY");
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
See the Parse documentation:
https://parse.com/apps/quickstart#parse_push/android/existing
Hint You should also not post your application key and ID.
Upvotes: 1