在 Android 上使用 Parse 库之前,您必须调用 Parse.initialize() [英] You must call Parse.initialize() before using Parse library on Android

查看:21
本文介绍了在 Android 上使用 Parse 库之前,您必须调用 Parse.initialize()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 Android 开发一个照片共享应用,它使用 Parse.com 平台作为后端.

I'm developing a photo sharing app for Android that uses the Parse.com platform for the backend.

我有一个主要活动,我在其中从 Parse 服务器获取照片,而且在此活动中,我有一个按钮可以开始拍摄照片活动!

I have a Main Activity where I'm fetching the photos from the Parse server and also here in this activity I have a button that starts a capture photo activity!

当我想在 Parse 服务器上上传照片时出现问题 - 我收到此消息:

The problem occurs when I want to upload the photo on the Parse server - I get this message:

You must call Parse.initialize(....) before using Parse library 

但我已经在启动画面活动中初始化 Parse 库 - 在 onCreate 方法中!

but I'm already initializing Parse library in my Splash Screen activity - in the onCreate method!

我还想提到该应用程序可以运行,但是当我更改 Main Activity 类时,这个问题开始出现!

I also wanted to mention that the app worked but when I've changed the Main Activity class this problems started to occur!

你知道是什么问题吗?

推荐答案

import com.parse.Parse;
    import android.app.Application;

    public class App extends Application {
      @Override
      public void onCreate() {
        super.onCreate();

        Parse.enableLocalDatastore(this);
        Parse.initialize(this, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);
      }
    }

AndroidManifest.xml

AndroidManifest.xml

<application
        android:name="yourpackagename.App"
.
.
.
</application>

这篇关于在 Android 上使用 Parse 库之前,您必须调用 Parse.initialize()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆