【问题标题】:Android app crash while accessing data from firebase从 Firebase 访问数据时 Android 应用程序崩溃
【发布时间】:2017-01-24 10:40:23
【问题描述】:

通过 android 调试器在我的 android 手机上运行我的应用程序时,我的应用程序运行正常。但是当我构建 apk 文件并将其安装在我的手机上时,它在访问来自 firebase 实时数据库的数据时会崩溃。我不知道该怎么办?

【问题讨论】:

  • 您应该尝试添加通过 adb 安装在真实设备上运行应用程序时获得的任何日志。
  • 我怀疑我的活动时间很长,因为我得到了以下日志:V/FA:活动恢复,时间:238480646 I/Choreographer:跳过 44 帧!应用程序可能在其主线程上做了太多工作。
  • 你的手机是什么版本的?

标签: android android-studio firebase firebase-realtime-database


【解决方案1】:

没有任何日志,给你一个有用的答案是疯狂的,但大多数崩溃的原因是清单中的互联网权限或一些被遗忘的活动。您还需要 Firebase 对设备存储的读取和写入权限。

【讨论】:

  • 我已附上我的cmets,请过一下:V/FA:活动恢复,时间:238480646 I/Choreographer:跳过44帧!应用程序可能在其主线程上做了太多工作。 ——
  • 请查看此帖子以使用有用的日志编辑您的帖子 (stackoverflow.com/questions/14678593/…)
【解决方案2】:

尝试这样做:

第 1 步:

首先在你的 gradle 中添加这个

compile 'com.android.support:multidex:1.0.1'

那么

创建一个应用程序类,例如MyApplication,然后:

public class MyApplication extends Application{
    private Context c;

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



    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }


}

然后最后转到您的清单并执行以下操作:

<application
        android:name="MyApplication"
        android:allowBackup="true"
        android:hardwareAccelerated="false"
        android:icon="@drawable/ic_icon"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

【讨论】:

    猜你喜欢
    • 2017-10-13
    • 1970-01-01
    • 1970-01-01
    • 2020-01-19
    • 1970-01-01
    • 1970-01-01
    • 2017-03-26
    • 2016-01-14
    • 2021-02-11
    相关资源
    最近更新 更多