I`m trying to enable multidex on my app of react-native but I get a error when the app is launched.
I already did the steps in the official doc of android: https://developer.android.com/studio/build/multidex
My build.gradel (android/app/build.gradel)
defaultConfig {
....
versionName "1.0"
multiDexEnabled true
}
...
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
...
}
And my AndroidManifest.xml:
<application
android:name="android.support.multidex.MultiDexApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
...
</application>
I don't understand what the problem is, why the error keeps happening when I start de app.
I`m using react-native V0.62.2
java.lang.ClassNotFound: Didn't find class “android.support.multidex.MultiDexApplication” on path: DexPathList
Don't
implementation 'com.android.support:multidex:1.0.3'
And
<application
android:name="android.support.multidex.MultiDexApplication"
AndroidX
replaces the original support library APIs with packages in the androidx namespace. So try with
<application
android:name="androidx.multidex.MultiDexApplication"
FYI
You should call
implementation 'androidx.multidex:multidex:2.0.1'
Then Clean-Rebuild-Run
.