After following the instructions mentioned at: https://developer.android.com/studio/build/multidex.html#mdex-gradle
I am getting an error cannot find symbol
The reason you are having this "symbol not found" issue is because you haven't imported the required imports. Why not simply add the following imports
import android.support.multidex.MultiDex;
import android.content.Context;
You should know the different cases for using each Multidex option. Kindly refer to https://developer.android.com/studio/build/multidex#java for all information relating to MultiDexing
Thanks to @Gabe Sechan for the help. I know React Native/JavaScript, kind of clueless about Android/Java, so I simply followed the instructions at https://developer.android.com/studio/build/multidex.html#mdex-gradle, which did not mention any additional imports. I learned to look up the package I needed here: https://developer.android.com/reference/android/support/multidex/MultiDexApplication.html. After adding:
import android.support.multidex.MultiDexApplication;
public class MainApplication extends MultiDexApplication implements ReactApplication {
...
App seems to build and run successfully on Android 4.4.4+ devices. On my Samsung Galaxy S3 simulator running 4.3 however, I am getting a crash upon app start: What does WIN DEATH: android.osDeadObjectException mean?, which seems like another issue altogether.
For those who get cannot find symbol error, the following is stated in the official android developer documents:
If your minSdkVersion is 21 or higher multidex is enabled by default, and you do not need the multidex support library.
If you are using RN > 0.60 and androidx support, you may add,
import androidx.multidex.MultiDex;