When I run my parse push application, I throw NullPointerException storage == null in Parse.initialize(ctx, “***”, “****”)…. here is a solution to the problem.
When I run my parse push application, I throw NullPointerException storage == null in Parse.initialize(ctx, “***”, “****”).
I followed the parsing quickstart guide in Parse to push and always throw NullPointerException storage == null
My app class
public class Application extends android.app.Application {
public Application() {
}
@Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, "****", "***");//Here throws the exception
ParseInstallation.getCurrentInstallation().saveInBackground();
}
and stack traces
08-14 00:19:47.866 31836-31836/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.easypass.app.cliente, PID: 31836
java.lang.RuntimeException: Unable to create application com.easypass.app.cliente.Application: java.lang.NullPointerException: storage == null
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4463)
at android.app.ActivityThread.access$1500(ActivityThread.java:146)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1274)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5280)
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:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException: storage == null
at java.util.Arrays$ArrayList.<init>(Arrays.java:38)
at java.util.Arrays.asList(Arrays.java:155)
at com.parse.ManifestInfo.hasRequestedPermissions(ManifestInfo.java:392)
at com.parse.ManifestInfo.hasAnyGcmSpecificDeclaration(ManifestInfo.java:454)
at com.parse.ManifestInfo.getPushType(ManifestInfo.java:201)
at com.parse.GcmRegistrar.registerAsync(GcmRegistrar.java:86)
at com.parse.Parse.initialize(Parse.java:230)
at com.easypass.app.cliente.Application.onCreate(Application.java:19)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4460)
Solution
The following permissions need to be placed before the tags in your list file.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />