-
Multidex with Gradle
about 9 years ago
-
almost 9 years ago
@rohit.puri you still taking me wrong, using your code multidex will be applicable for only api 14 but i dont want to put an api check, rather i want to put check on my apps different flavors, so please help me with that.....
-
-
about 9 years ago
@Anupriya you should create an Application class that will extend Application and in onBaseContext you can run multidex if flavor or api version match like this :
public class YouApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); if (android.os.Build.VERSION.SDKINT == 14) { MultiDex.install(this); } }
-
-
about 9 years ago
@rohit.puri I think you are taking me wrong, I just wanna know if I want to apply mutidex only for one of my flavors, then how I could achieve that??
-
-
about 9 years ago
@Anupriya yes you can define min sdk version for each flavor like this in your app gradle under android tag :
productFlavors { dev { minSdkVersion 21 } prod { minSdkVersion 14 } }
-
-
about 9 years ago
By including android:name="android.support.multidex.MultiDexApplication" in your application Tag, you are making it available for your whole application, but what if i want to make it applicable for only one of the flavors of my app?
-
5 Comment(s)