Since multidex needs to be enabled to support our app and all its dependencies (including Google Play services and FireBase), we have a couple options:
1) To allow for the app to run on SDK versions < 21, we need to import only the dependencies from Google Play Services that the application needs, instead of importing the whole thing (e.g. don't compile 'com.google.android.gms:play-services:10.2.4') . This is most likely the main cause since Android 5.0+ supports ART (Android Runtime), instead of Dalvik. Therefore, by using Android Runtime, it can support more than 65,536 methods. This is why the app could run on my Samsung S4 (Android 4.4.4 API Level 19) before we imported FireBase and Google Play Services, since Multidex didn't need to be enabled.
2) The other solution would be to set the minimum SDK version to 21, so that only Android devices 5.0+ can run the application. The only drawback is that we can't support devices prior to that.
Since multidex needs to be enabled to support our app and all its dependencies (including Google Play services and FireBase), we have a couple options:
1) To allow for the app to run on SDK versions < 21, we need to import only the dependencies from Google Play Services that the application needs, instead of importing the whole thing (e.g. don't compile 'com.google.android.gms:play-services:10.2.4') . This is most likely the main cause since Android 5.0+ supports ART (Android Runtime), instead of Dalvik. Therefore, by using Android Runtime, it can support more than 65,536 methods. This is why the app could run on my Samsung S4 (Android 4.4.4 API Level 19) before we imported FireBase and Google Play Services, since Multidex didn't need to be enabled.
2) The other solution would be to set the minimum SDK version to 21, so that only Android devices 5.0+ can run the application. The only drawback is that we can't support devices prior to that.