Trying to add MultiDex support - cannot find symbol context and MultiDex
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.
If you are using RN > 0.60 and androidx support, you may add,
import androidx.multidex.MultiDex;
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.
Adding dependencies: { implementation 'com.android.support:multidex:1.0.3' }
into android/app/build.gradle fixed my problem. It happened when I bumped minSDKversion to 21.