我有很多用户向Play控制台报告此崩溃。我测试了它,它有时只出现。崩溃发生在我在ParseApplication类中的这一行中,该类扩展了Application类,应该在其他所有内容之前调用它?
这是它崩溃的地方:
Parse.initialize(this, "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXX");
这是崩溃
java.lang.RuntimeException: Unable to create application com.hour.chat.ParseApplication: java.util.ConcurrentModificationException
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4411)
at android.app.ActivityThread.access$1500(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1266)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5081)
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:781)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.util.ConcurrentModificationException
at java.util.LinkedList$LinkIterator.next(LinkedList.java:124)
at com.parse.ParseObject.mergeREST(ParseObject.java:928)
at com.parse.ParseUser.mergeREST(ParseUser.java:285)
at com.parse.OfflineStore$13$2.then(OfflineStore.java:765)
at com.parse.OfflineStore$13$2.then(OfflineStore.java:762)
at com.parse.Task$10.run(Task.java:448)
at com.parse.Task$ImmediateExecutor.execute(Task.java:673)
at com.parse.Task.completeImmediately(Task.java:444)
at com.parse.Task.continueWith(Task.java:318)
at com.parse.Task.continueWith(Task.java:329)
at com.parse.Task$8.then(Task.java:381)
at com.parse.Task$8.then(Task.java:373)
at com.parse.Task$11.run(Task.java:481)
at com.parse.Task$ImmediateExecutor.execute(Task.java:673)
at com.parse.Task.completeAfterTask(Task.java:477)
at com.parse.Task.continueWithTask(Task.java:353)
at com.parse.Task.onSuccess(Task.java:373)
at com.parse.Task.onSuccess(Task.java:393)
at com.parse.OfflineStore$13.then(OfflineStore.java:762)
at com.parse.OfflineStore$13.then(OfflineStore.java:721)
at com.parse.Task$11.run(Task.java:481)
at com.parse.Task$ImmediateExecutor.execute(Task.java:673)
at com.parse.Task.completeAfterTask(Task.java:477)
at com.parse.Task.continueWithTask(Task.java:353)
at com.parse.Task.continueWithTask(Task.java:364)
at com.parse.Task$9.then(Task.java:410)
at com.parse.Task$9.then(Task.java:402)
at com.parse.Task$11.run(Task.java:481)
at com.parse.Task$ImmediateExecutor.execute(Task.java:673)
at com.parse.Task.completeAfterTask(Task.java:477)
at com.parse.Task.access$400(Task.java:22)
at com.parse.Task$7.then(Task.java:346)
at com.parse.Task$7.then(Task.java:343)
at com.parse.Task.runContinuations(Task.java:510)
at com.parse.Task.access$800(Task.java:22)
at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:565)
at com.parse.Task$TaskCompletionSource.setResult(Task.java:599)
at com.parse.Task$11$1.then(Task.java:493)
at com.parse.Task$11$1.then(Task.java:485)
at com.parse.Task$10.run(Task.java:448)
at com.parse.Task$ImmediateExecutor.execute(Task.java:673)
at com.parse.Task.completeImmediately(Task.java:444)
at com.parse.Task.continueWith(Task.java:318)
at com.parse.Task.continueWith(Task.java:329)
at com.parse.Task$11.run(Task.java:485)
at com.parse.Task$ImmediateExecutor.execute(Task.java:673)
at com.parse.Task.completeAfterTask(Task.java:477)
at com.parse.Task.access$400(Task.java:22)
at com.parse.Task$7.then(Task.java:346)
at com.parse.Task$7.then(Task.java:343)
at com.parse.Task.runContinuations(Task.java:510)
at com.parse.Task.access$800(Task.java:22)
at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:565)
at com.parse.Task$TaskCompletionSource.setResult(Task.java:599)
at com.parse.Task$11$1.then(Task.java:493)
at com.parse.Task$11$1.then(Task.java:485)
at com.parse.Task$10.run(Task.java:448)
at com.parse.Task$ImmediateExecutor.execute(Task.java:673)
at com.parse.Task.completeImmediately(Task.java:444)
at com.parse.Task.continueWith(Task.java:318)
at com.parse.Task.continueWith(Task.java:329)
at com.parse.Task$11.run(Task.java:485)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
答案 0 :(得分:0)
由于这个帖子是4个月大,所以先让我们更新一些东西;
1)更新到最新的SDK,您可以在Parse
执行此操作2)确保在项目中有SDK后,在应用程序级别正确初始化了密钥,如下所示:
public class YourAppName extends Application {
@Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, "KEY_1", "KEY_2);
}
}
3)确保在AndroidManifest.xml中定义了这个:
<application
android:name=".YourAppName" <!--This is the important part-->
android:allowBackup="true"
android:icon="@drawable/launcher_icon"
android:label="@string/app_name"
android:theme="@style/Theme.MyTheme">
...
希望它能解决你的问题。