首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >解析Android-SDK在初始化时崩溃。

解析Android-SDK在初始化时崩溃。
EN

Stack Overflow用户
提问于 2015-05-09 11:23:13
回答 1查看 407关注 0票数 0

我只是简单地阅读了关于在Parse上存储数据的教程,并收到了:

“在以前失败的类java.lang.Class上拒绝re。

我做了什么:

  1. 将'Parse-1.9.1.jar‘复制到我的lib目录(Android,已经成功地集成了其他SDK)
  2. 将以下行添加到我的“build.gradle”依赖项中:
代码语言:javascript
复制
- compile fileTree(dir: 'libs', include: 'bolts-android-\*.jar')
- compile fileTree(dir: 'libs', include: 'Parse-\*.jar')

  1. 在我的“OnCreate”函数中添加了以下行:
代码语言:javascript
复制
- Parse.enableLocalDatastore(this);
- Parse.initialize(this, \_\_\_\_\_\_ , \_\_\_\_\_\_\_);

  1. 应用程序因错误而崩溃:

在以前失败的类java.lang.Class com.parse.OfflineStore$32上拒绝re

EN

回答 1

Stack Overflow用户

发布于 2015-05-09 13:03:59

您应该创建一个单独的类来扩展Application,并在那里执行Parse初始化和启用数据库内容。应该是,

代码语言:javascript
复制
public class ParseApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        ParseCrashReporting.enable(this);
        Parse.enableLocalDatastore(this);
        Parse.initialize(this, "xxx", "xxx");
    }
  } 

在AndroidManifest.xml中,将ParseApplication类添加到应用程序中

代码语言:javascript
复制
<application
        android:name="com.example.parsetry.ParseApplication" // you should replace this based on your package
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30139307

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档