简体   繁体   English

启动应用程序时,我将parse.com用作后端不幸的是发生了停止的错误,请参见下面的datails

[英]i am using parse.com as backend when i start app Unfortunately stopped error occurs ,see datails below thanks

i am using Parse.com as my backend on android platform ,in which i created application class extends application and initialized app key ,client key that stuff class code is below 我正在使用Parse.com作为我在android平台上的后端,在其中创建了应用程序类,扩展了应用程序并初始化了应用程序密钥,客户端类代码如下

public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Parse.initialize(this, getString(R.string.app_id), getString(R.string.client_id));
        Parse.enableLocalDatastore(this);

        ParseInstallation.getCurrentInstallation().saveInBackground();
    }
}

and also created a launcher activity code is below 并在下面创建了启动器活动代码

public class Splash extends AppCompatActivity {
    Button signup, login;
    ProgressBar progressBar;
    public static Activity fa;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        fa=this;

        signup = (Button) findViewById(R.id.signupbutton);
        login = (Button) findViewById(R.id.loginbutton);
        progressBar = (ProgressBar) findViewById(R.id.progressBar);
        signup.setVisibility(View.INVISIBLE);
        login.setVisibility(View.INVISIBLE);

        if (AppStatus.getInstance(this).isOnline()) {


                ParseUser currentUser = ParseUser.getCurrentUser();
                if (currentUser != null) {
                    Intent intent = new Intent(this, HomePage.class);
                    startActivity(intent);
                    finish();

                } else {
                    progressBar.setVisibility(View.GONE);
                    signup.setVisibility(View.VISIBLE);
                    login.setVisibility(View.VISIBLE);
                    signup.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Intent intent = new Intent(Splash.this, Signup.class);
                            startActivity(intent);
                        }
                    });
                    login.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Intent intent = new Intent(Splash.this, LogIn.class);
                            startActivity(intent);
                        }
                    });

                }


        } else {
            FragmentManager manager = getSupportFragmentManager();
            mydig mydig = new mydig();
            mydig.setCancelable(false);
            mydig.show(manager, "mydig");

        }
    }




}

now when i start app app gets gets error unfortunately stopped,error shown by logcat is below 现在,当我启动应用程序时,应用程序遇到错误,很遗憾已停止,logcat显示的错误如下

08-29 14:30:30.253  26799-26799/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.nintysixkmdev.supercollege, PID: 26799
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nintysixkmdev.supercollege/com.nintysixkmdev.supercollege.Splash}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File com.parse.ParsePlugins.getParseDir()' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File com.parse.ParsePlugins.getParseDir()' on a null object reference
            at com.parse.Parse.getParseDir(Parse.java:304)
            at com.parse.ParseObject.getFromDisk(ParseObject.java:667)
            at com.parse.ParseUser$10.then(ParseUser.java:1056)
            at com.parse.ParseUser$10.then(ParseUser.java:1003)
            at bolts.Task$14.run(Task.java:796)
            at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
            at bolts.Task.completeAfterTask(Task.java:787)
            at bolts.Task.continueWithTask(Task.java:599)
            at bolts.Task.continueWithTask(Task.java:610)
            at com.parse.ParseUser.getCurrentUserAsync(ParseUser.java:1003)
            at com.parse.ParseUser.access$800(ParseUser.java:26)
            at com.parse.ParseUser$9.then(ParseUser.java:996)
            at com.parse.ParseUser$9.then(ParseUser.java:993)
            at com.parse.TaskQueue.enqueue(TaskQueue.java:61)
            at com.parse.ParseUser.getCurrentUserAsync(ParseUser.java:993)
            at com.parse.ParseUser.getCurrentUser(ParseUser.java:979)
            at com.parse.ParseUser.getCurrentUser(ParseUser.java:966)
            at com.nintysixkmdev.supercollege.Splash.onCreate(Splash.java:40)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

can anyone tell me problem in my code. 谁能告诉我代码中的问题。 Thanks 谢谢

i named Class As Application n Also Extended Application i think there is the prob. 我将类命名为应用程序n也将扩展应用程序命名为问题。 when i changed name of class my code worked Thanks all of you 当我更改班级名称时,我的代码正常工作谢谢大家

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在使用parse.com推送通知功能,但适用于prelollipop设备,请参见下面的详细信息,谢谢 - i am using parse.com push notification feature but it works for prelollipop devices see details below thanks 当我关闭应用程序n重新打开它时,使用parse.com lib创建应用程序,不幸的是它停止了 - creating app using parse.com lib.when i close app n reopen it ,it says unfortunately stopped 当我使用Genymotion模拟器运行我的第一个android应用程序时,不幸的是,其给出的错误“应用程序名称”已停止。 请帮我 - When I am running my first android app using Genymotion emulator its giving error unfortunately “app name” has stopped. Please help me 不幸的是,如果我将PaintDrawable强制转换为Drawable,则在调试时应用程序已停止 - unfortunately the app has stopped when i am debugging if I cast PaintDrawable to Drawable 我正在尝试将数据输入parse.com中的custmom列,但出现错误 - I am trying to enter data to a custmom column in parse.com ,but I am getting an error Parse.com查询在数据浏览器中返回0结果我可以看到有2个结果 - Parse.com query returning 0 results when in the Data browser I can see there are 2 results 当我要将字符串转换为Long时,“不幸的是,应用程序已停止” - “Unfortunately app has stopped” when I want to convert the string to Long 我想在android中实现SeekBar,但是当我运行以下程序时,我的模拟器显示错误“不幸的是SeekBar已停止” - I want to implement SeekBar in android ,But when i run the below program my emulator shows error that “Unfortunately SeekBar has been stopped” 不幸的是,当我使用Eclipse在模拟器中启动我的应用程序时,Myapp已停止 - Unfortunately Myapp has stopped when i was launch My app in emulator using Eclipse 不幸的是,当我单击按钮时,应用程序已停止 - App unfortunately has stopped when i click the button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM