Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Manifest vs Gradle Script

I set minSdkVersion to be 8 in Gradle build script and minSdkVersion to be 4 in Android module manifest.

Which one is taken? Why aren't these 2 synchronized?

like image 792
stuckedoverflow Avatar asked Jan 27 '15 15:01

stuckedoverflow


1 Answers

When there was no gradle support in Android, the manifest ruled it all. Now, if you added gradle support to your project, old manifest tags are simply ignored, as gradle builds your app and decides which is correct minimum version.

The main reason of this has to be identified in this fact:

These build values override the existing values in the manifest file. This is useful if you want to generate multiple APKs for your modules where each of the apk files has a different application name, minimum SDK version, or target SDK version. When multiple manifests are present, manifest settings are merged in priority of buildType and productFlavor, /main manifest, and the library manifests

In other words, gradle allows Build variants and lets you specify min and target SDKs for each.

like image 71
Shine Avatar answered Nov 15 '22 20:11

Shine