且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

添加Firestore和MultiDex导致我的Android应用崩溃

更新时间:2023-11-17 18:48:58

我终于知道了!问题是我正在遵循Google文档将MultiDex添加到我的应用程序中,但是其中有一个关键行已过期,这导致该应用程序崩溃.相关文档位于此处.

I have finally figured it out! The issue was that I was following the Google documentation for adding MultiDex to my app, however there is one key line which is out of date which was causing the app to crash. The documentation in question is here.

文档中的错误指示是将行 android:name ="android.support.multidex.MultiDexApplication"> 添加到清单文件中,如下所示:

The incorrect instruction in the documentation is to add the line android:name="android.support.multidex.MultiDexApplication" > to the Manifest file like so:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">
    <application
            <!--Incorrect-->
            android:name="android.support.multidex.MultiDexApplication" >
        ...
    </application>
</manifest>

但是,多亏了Ivan Vovk对此问题的第二个答案的评论,应该添加到清单文件中的行是:

However, thanks to a comment from Ivan Vovk on the second answer to this question, the correct line that should be added to the Manifest file is:

android:name ="androidx.multidex.MultiDexApplication"

进行此更正后,我能够在没有任何崩溃的情况下运行该应用程序.

After I made this correction, I was able to run the app without any crashes.