0
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.7.0'
}
}

allprojects {
repositories {
    mavenCentral()
}
}

apply plugin: 'android'

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
    }
}

defaultConfig {
    minSdkVersion 8
    targetSdkVersion 16
}
}

Still no luck after much researching. I change the version number, and the android manifest matches the minSdkVersion and targetSdkVersion as the build.gradle file above. No idea why this doesn't work?!?

1 Answers1

0

In gradle build system minSdkVersion and targetSdkVersion defined in AndroidManifest.xml file will be replaced by what you have mentioned in build.gradle file.

If you are using multiple modules or libraries in your project make sure all build.gradle files as well as AndroidManifest.xml files having same set of configuration for minSdkVersion and targetSdkVersion.

UPDATED

It might possible that any library like google_play_services or other is using different minsdkVersion .

Check your Gradle Console output and make the required changes in your AndroidManifest.xml files as well as in build.gradle files. Also take care that all your build.gradle and AndroidManifest.xml files should have same minsdkVersion. I tried with different values and finally found that most of the libraries uses minSdkVersion 8 .

Also for better practice you can remove min and target sdk from Manifest and have them in build.gradle file only for minimal confusion.

Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111