How to specify the minSdkVersion in react native project
I have these settings in the android\build.gradle file as per below...
buildscript {
ext {
supportLibVersion = "28.0.0"
buildToolsVersion = "28.0.3"
minSdkVersion = 23
compileSdkVersion = 28
targetSdkVersion = 28
}
}
You might like to notice that react-native lib/package/module (as you wish) sets the minSdkVersion
to 16
. You can see it here on their official build.gradle file:
android {
compileSdkVersion 28
...
defaultConfig {
minSdkVersion(16)
targetSdkVersion(28)
versionCode(1)
versionName("1.0")
}
...
}
https://github.com/facebook/react-native/blob/7a72c35a20a18c19bf6ab883cb2c53a85bd4c5c0/ReactAndroid/build.gradle#L356
By setting minSdkVersion
to 16
, react-native uses Android API's natively supported by at least KitKat version.
You may see the official Platform Version Dashboard here: https://developer.android.com/about/dashboards/index.html
You can change it from app/build.gradle
directly
Open the project go to the android/app
folder and open build.gradle
file.
In this you can find
defaultConfig {
applicationId "PACKAGE_ID"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
change this minSdkVersion 16
according to your requirement