当我运行我的解析推送应用程序时,在Parse.initialize中抛出NullPointerException storage == null(ctx," ***"," ***")

时间:2015-08-14 05:28:02

标签: java android

我按照解析快速入门指南推送Parse并且总是抛出NullPointerException storage == null

我的申请类

<?php
   $number = 10000;
   $formatted_number = number_format($number);
?>

}

和堆栈跟踪

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();
}

2 个答案:

答案 0 :(得分:7)

需要在标记之前的清单文件中放置以下权限。

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

答案 1 :(得分:3)

在初始化Parse.enableLocalDatastore(this);之前尝试添加Parse。像这样:

@Override
public void onCreate() {
    super.onCreate();
    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);
    Parse.initialize(getApplicationContext(), "****", "***");//Here throws the exception
    ParseInstallation.getCurrentInstallation().saveInBackground();
}