Gradle automatically fill-in targetSdkVersion when compiling an Android application source code

We used Android Studio 1.4 together with Gradle 2.4 and Android Plugin for Gradle 1.3

Here in our AndroidManifest.xml, for certain reason we only set the minSdkVersion = 14 and we don’t set any targetSdkVersion, which according to Android developer website, should always default to the same value as minSdkVersion 14 in this case.

We are doing fine with previous Eclipse IDE + Apache Maven build.

However since we migrated to Android Studio + Gradle, there was a degraded performance issue reported on Android 4.3 by our tester where the app source code is same as previous except that the IDE and the build system is changed.

We used apktool to decompile our app’s APK and found from the apktool.yml that the targetSdkVersion becomes 16.

We believe this is an issue with Gradle, appreciate if someone can help to provide any response.

Thanks,
Jeffrey

This behavior would be controlled by the Android plugin. You might try using the latest plugin version (1.5 I believe) and verify that this is still a problem. If so you might want to report a bug with them.

https://code.google.com/p/android/issues/list

The issue remains with com.android.tools.build:gradle:1.5.0.

We fire the case to Google instead:
https://code.google.com/p/android/issues/detail?id=202264

Thanks