几天前,当我运行它时,我问了一个关于应用程序崩溃的问题。这是the link。
我解决了问题,但是当我按下主页并重新打开应用程序时崩溃说不幸应用程序停止了。现在,如果我重新打开应用程序它可以工作,但按下主页按钮并重新打开应用程序时会发生同样的情况。不知道是什么问题 这是logcat
Thread started: <Thread Pool> #6
11-11 15:11:06.144 W/ (19542): _wapi_connect: error looking up socket handle 0x26
11-11 15:11:06.177 D/Mono (19542): DllImport attempting to load: '/system/lib/liblog.so'.
11-11 15:11:06.177 D/Mono (19542): DllImport loaded library '/system/lib/liblog.so'.
11-11 15:11:06.177 D/Mono (19542): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
11-11 15:11:06.177 D/Mono (19542): Searching for '__android_log_print'.
11-11 15:11:06.177 D/Mono (19542): Probing '__android_log_print'.
11-11 15:11:06.177 D/Mono (19542): Found as '__android_log_print'.
11-11 15:11:06.178 I/MonoDroid(19542): UNHANDLED EXCEPTION:
11-11 15:11:06.179 I/MonoDroid(19542): System.Threading.Tasks.TaskCanceledException: A task was canceled.
11-11 15:11:06.179 I/MonoDroid(19542): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b>
11-11 15:11:06.179 I/MonoDroid(19542): at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <IL 0x00006, 0x0003b>
11-11 15:11:06.179 I/MonoDroid(19542): at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <IL 0x0000c, 0x00032>
11-11 15:11:06.179 I/MonoDroid(19542): at Java.Lang.Thread/RunnableImplementor.Run () <IL 0x00011, 0x0004c>
11-11 15:11:06.179 I/MonoDroid(19542): at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <IL 0x0000a, 0x0005e>
11-11 15:11:06.179 I/MonoDroid(19542): at (wrapper dynamic-method) object.b257f262-40d0-43f7-b8b4-43d0ec65bc72 (intptr,intptr) <IL 0x00011, 0x0001f>
11-11 15:11:06.186 W/art (19542): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
11-11 15:11:06.188 D/AndroidRuntime(19542): Shutting down VM
An unhandled exception occured.
11-11 15:12:58.748 E/AndroidRuntime(19542): FATAL EXCEPTION: main
11-11 15:12:58.748 E/AndroidRuntime(19542): Process: AndroidConsumer.AndroidConsumer, PID: 19542
11-11 15:12:58.748 E/AndroidRuntime(19542): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
11-11 15:12:58.748 E/AndroidRuntime(19542): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
11-11 15:12:58.748 E/AndroidRuntime(19542): Caused by: java.lang.reflect.InvocationTargetException
11-11 15:12:58.748 E/AndroidRuntime(19542): at java.lang.reflect.Method.invoke(Native Method)
11-11 15:12:58.748 E/AndroidRuntime(19542): at java.lang.reflect.Method.invoke(Method.java:372)
11-11 15:12:58.748 E/AndroidRuntime(19542): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
11-11 15:12:58.748 E/AndroidRuntime(19542): ... 1 more
11-11 15:12:58.748 E/AndroidRuntime(19542): Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.Threading.Tasks.TaskCanceledException: A task was canceled.
11-11 15:12:58.748 E/AndroidRuntime(19542): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b>
11-11 15:12:58.748 E/AndroidRuntime(19542): at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <IL 0x00006, 0x0003b>
11-11 15:12:58.748 E/AndroidRuntime(19542): at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <IL 0x0000c, 0x00032>
11-11 15:12:58.748 E/AndroidRuntime(19542): at Java.Lang.Thread/RunnableImplementor.Run () <IL 0x00011, 0x0004c>
11-11 15:12:58.748 E/AndroidRuntime(19542): at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <IL 0x0000a, 0x0005e>
11-11 15:12:58.748 E/AndroidRuntime(19542): at (wrapper dynamic-method) object.b257f262-40d0-43f7-b8b4-43d0ec65bc72 (intptr,intptr) <IL 0x00011, 0x0001f>
11-11 15:12:58.748 E/AndroidRuntime(19542):
11-11 15:12:58.748 E/AndroidRuntime(19542): at mono.java.lang.RunnableImplementor.n_run(Native Method)
11-11 15:12:58.748 E/AndroidRuntime(19542): at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
11-11 15:12:58.748 E/AndroidRuntime(19542): at android.os.Handler.handleCallback(Handler.java:739)
11-11 15:12:58.748 E/AndroidRuntime(19542): at android.os.Handler.dispatchMessage(Handler.java:95)
11-11 15:12:58.748 E/AndroidRuntime(19542): at android.os.Looper.loop(Looper.java:135)
11-11 15:12:58.748 E/AndroidRuntime(19542): at android.app.ActivityThread.main(ActivityThread.java:5253)
11-11 15:12:58.748 E/AndroidRuntime(19542): ... 4 more
11-11 15:12:58.877 I/Process (19542): Sending signal. PID: 19542 SIG: 9
答案 0 :(得分:0)
引起:java.lang。 NullPointerException :尝试调用虚拟 方法&#39; java.io.File com.parse.ParsePlugins.getParseDir()&#39;在 null 对象参考
检查您的代码,您是否尝试在 null 对象上调用getParseDir()
方法。
答案 1 :(得分:0)
您应该在Application类中初始化Parse,就像您在此处尝试的那样:
public class ParseApplication extends Application
{
@Override
public void onCreate()
{
// TODO: Implement this method
super.onCreate();
Parse.initialize(this, "9MoehuvnUJRKcvF8SL3nbW0slHHJNPJU4ONXGcD5", "kmBoHM4iwdm0YiyeR7aoMlyMgC5oh1oyTIOt34iu");
但要实现这一点,您还必须手动在AndroidManifest.xml
中指定应用程序类。
<application name="com.mycompany.myapp.ParseApplication"
答案 2 :(得分:0)
试试这段代码
//Note that this is an android.app.Application class.
public class MyApplication extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
//This will only be called once in your app's entire lifecycle.
Parse.initialize(this,
getResources().getString(R.string.parse_application_id),
getResources().getString(R.string.parse_client_key));
}
的 AndroidManifest:
<application
android:name=".MyApplication">
....
<activity>
....
</activity>