DexOverflowException after adding com.google.firebase: firebase-firestore: 11.4.2

I had a problem after adding the compilation "com.google.firebase: firebase-firestore: 11.4.2" to my assembly.

As soon as I add this, it also adds com.google.common, among other things, to my dex file, which contains about 27 thousand sitelinks, thus breaking in the 64k dex limit.

Does anyone know why this is so, or am I doing something wrong?

+4
source share
3 answers

Try adding these lines to build.gradle

android {
    defaultConfig {
        ...
        minSdkVersion 21 
        targetSdkVersion 26
        multiDexEnabled true
    }
    ...
}

This will allow you to use multidex mode, which allows you to exceed the 64k limit. (More info here )

API below 21

API 21,

gradle.build:

dependencies {
    compile 'com.android.support:multidex:1.0.1'
}

android.manafest

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

Application,

1

MultiDexApplication

public class MyApplication extends MultiDexApplication { ... }

2

attachBaseContext MultiDex install(Application)

public class MyApplication extends SomeOtherApplication {
  @Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }
}
+5

: API Android Cloud Firestore . SDK GA.

multidex , .

com.google.common, , 64k, .

+3

Updating to 11.6.0 fixes this problem.

+1
source

Source: https://habr.com/ru/post/1687055/


All Articles