Skip to content

Commit 1512242

Browse files
committed
Get Android's minSdkVersion from user's app
1 parent a30a507 commit 1512242

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

android/build.gradle

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11

22
apply plugin: 'com.android.library'
33

4-
def DEFAULT_COMPILE_SDK_VERSION = 28
5-
def DEFAULT_BUILD_TOOLS_VERSION = "28.0.0"
6-
def DEFAULT_TARGET_SDK_VERSION = 28
4+
String getExtOrDefault(String name) {
5+
if (rootProject.ext.has(name)) {
6+
return rootProject.ext.get(name)
7+
}
8+
return project.properties['InstabugReactNative_' + name]
9+
}
710

811
android {
9-
compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
10-
buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
12+
compileSdkVersion getExtOrDefault('compileSdkVersion')
13+
buildToolsVersion getExtOrDefault('buildToolsVersion')
1114

1215
defaultConfig {
13-
minSdkVersion 16
14-
targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
16+
minSdkVersion getExtOrDefault('minSdkVersion')
17+
targetSdkVersion getExtOrDefault('targetSdkVersion')
1518
versionCode 1
1619
versionName "1.0"
1720
ndk {

android/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
InstabugReactNative_compileSdkVersion=28
2+
InstabugReactNative_buildToolsVersion=28.0.0
3+
InstabugReactNative_targetSdkVersion=28
4+
InstabugReactNative_minSdkVersion=16

0 commit comments

Comments
 (0)