Skip to content

Commit

Permalink
docs(*): move enabling multidex to root
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehesp committed Apr 8, 2020
1 parent 670f0b1 commit 88b58eb
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 35 deletions.
35 changes: 35 additions & 0 deletions docs/enabling-multidex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Enabling Multidex
description: Learn how to enable multidex on your Android application.
---

As more native dependencies are added to your project, it may bump you over the
64k method limit on the Android build system. Once this limit has been reached, you will start to see the following error
whilst attempting to build your Android application:

```
Execution failed for task ':app:mergeDexDebug'.
```

To learn more about multidex, view the offical [Android documentation](https://developer.android.com/studio/build/multidex#mdex-gradle).

## Enabling Multidex

Open the `/android/app/build.gradle` file. Under `dependencies` we need to add the module, and then enable it
within out `defaultConfig`:

```groovy
android {
defaultConfig {
// ...
multiDexEnabled true
}
// ...
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'

This comment has been minimized.

Copy link
@mikehardy

mikehardy Apr 8, 2020

Collaborator

@Ehesp should be androidx now?

    implementation 'androidx.multidex:multidex:2.0.1'

Also, it needs a change to MainApplication.java, specifically an extra import and a change to extends:

import androidx.multidex.MultiDexApplication;

...[etc]...

public class MainApplication extends MultiDexApplication implements ReactApplication {

    ...[etc]...

}
}
```

Once added, rebuild your application: `npx react-native run-android`.
33 changes: 0 additions & 33 deletions docs/firestore/enabling-multidex.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/firestore/usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ cd ios/ && pod install
If you're using an older version of React Native without autolinking support, or wish to integrate into an existing project,
you can follow the manual installation steps for [iOS](/firestore/usage/installation/ios) and [Android](firestore/usage/installation/android).

In some scenarios, your Android build may fail with the `app:mergeDexDebug` error. This required that multidex is enabled
for your application. To learn more, read the [Enabling Multidex](/firestore/enabling-multidex) documentation.
If you have started to receive a `app:mergeDexDebug` error after adding Cloud Firestore, please read the
[Enabling Multidex](/enabling-multidex) documentation for more information on how to resolve this error.

# What does it do

Expand Down
9 changes: 9 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ you can follow the manual installation steps for [iOS](/install-ios) and [Androi

# Miscellaneous

## Android Enabling Multidex

As your application starts to grow with more native dependencies, your builds may start to fail with the common
`Execution failed for task ':app:mergeDexDebug'` error. This error occurs when Android reaches the
[64k methods](https://developer.android.com/studio/build/multidex) limit.

One common solution is to [enable multidex](/enabling-multidex) support for Android. This is a common solution to solving
the problem, however it is recommended you read the Android documentation to understand how it may impact your application.

## Hermes Support

At this time, React Native Firebase does not support the [Hermes](https://hermesengine.dev/) JavaScript engine due to
Expand Down

0 comments on commit 88b58eb

Please sign in to comment.