This goes together with the reset of the steps in https://developer.android.com/studio/build/multidex.html
This is our MainApplication.java
without all the third party packages we import and use.
The key things are to import the class:
import android.support.multidex.MultiDexApplication;
and extend it:
public class MainApplication extends MultiDexApplication implements ReactApplication
You can remove the import android.app.Application;
line from the default react cli init
package com.streetcred.mapnyc;
import android.support.multidex.MultiDexApplication;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends MultiDexApplication implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}