It looks like the minSdkVersion check is not taking into account the version injected from the build.gradle and instead relies on the one present in the manifest file. We are investigating.
On Thu, May 1, 2014 at 6:21 AM, Mateusz Grzechociński < [email protected]> wrote: > Hi, > > I've just upgraded to Gradle 1.12 and Android gradle plugin v1.10. Just > out of curiosity, I also switched to new android manifest merger by > specifying: > > android{ > useOldManifestMerger false > } > > After switch, I encountered several problems. All but one were very clear > for me and I fixed them in a couple of minutes - duplicated permissions, > missing package names etc. Btw, I love the ${packageName} expression to be > used in intent filters etc. > > The last problem I have is with merging android:minSdkVersion attribute > between my app buildTypes/flavors/dependencies. > > My project structure is just a standard: > > - root > -- app (app is build to APK and has dependency to app compat library) > > My app module has several build types and flavours. One of the build type > and flavour configuration is Mo (flavour) Debug (buildType). In both > debug/ and mo/ folders I have a manifest files which, in debug/ adds some > additional activities to main manifest (DeveloperOptionsActivity etc) and > in mo/ adds some additional permissions for GCM for different environment. > > In build.gradle of my app module I have: > > defaultConfig { > minSdkVersion 9 > targetSdkVersion 19 > [...] > } > > buildTypes { > debug { > debuggable true > packageNameSuffix ".debug" > runProguard false > } > ... > } > > productFlavors { > mo { > } > ... > } > > Neither my main/ nor debug/ nor /mo AndroidManifest.xml specify > <users-sdk /> since when they do, lint says: > > <http://f.cl.ly/items/0x3F1y1H0u38122J1I0C/Image%202014-05-01%20at%203.06.29%20pm.png> > So I removed it from all main/ and debug/ and mo/ AndroidManifest.xml. > > Once I did it, I see: > > *app:processMoDebugManifest* > /Users/mateuszgrzechocinski/[...]/app/src/debug/AndroidManifest.xml:0:0 > Error: > uses-sdk:minSdkVersion 1 cannot be smaller than version 7 declared in > library com.android.support:appcompat-v7:19.0.1 > :app:processMoDebugManifest FAILED > > FAILURE: Build failed with an exception. > > * What went wrong: > Execution failed for task ':app:processMoDebugManifest'. > > Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than > version 7 declared in library com.android.support:appcompat-v7:19.0.1 > > The only way to get rid of this issue it to put <uses-sdk > androidMinSdkVersion="9" /> in my debug/AndroidManifest.xml. That's not > what I want, since I'd like one, and only one place for minSdkVersion to > be set for my whole application and it's android{ minSdkVersion 9 } in my > build.gradle. Lint thinks the same, I guess. > > What's more interesting, putting <uses-sdk androidMinSdkVersion="9" /> > in my main/ AndroidManifest.xml file doesn't change anything. Seems like > every AndroidManifest.xml variant have to have it's owns <uses-sdk />, or > am I missing something? > > Thanks in advance and thank you Xavier and your team for a tremendous work! > > Matthew > > > -- > You received this message because you are subscribed to the Google Groups > "adt-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. http://developer.android.com | http://tools.android.com Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
