android: better check for useAndroidX

This commit is contained in:
Kesha Antonov
2023-07-14 14:18:58 +03:00
parent 906e744330
commit bb436069b6
+10 -8
View File
@@ -1,19 +1,21 @@
apply plugin: 'com.android.library'
def useAndroidX = (project.hasProperty('android.useAndroidX')) ? project.property('android.useAndroidX') : false
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 33)
compileSdkVersion safeExtGet('compileSdkVersion', 33)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 33)
versionCode 1
versionName "1.0"
versionName '1.0'
ndk {
abiFilters "armeabi-v7a", "x86"
abiFilters 'armeabi-v7a', 'x86'
}
}
}
@@ -21,11 +23,11 @@ android {
dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
if (project.properties['android.useAndroidX'] == 'true') {
api "com.github.tonyofrancis.Fetch:xfetch2:3.1.6"
implementation "com.github.tonyofrancis.Fetch:xfetch2okhttp:3.1.6"
if (useAndroidX) {
api 'com.github.tonyofrancis.Fetch:xfetch2:3.1.6'
implementation 'com.github.tonyofrancis.Fetch:xfetch2okhttp:3.1.6'
} else {
api "com.tonyodev.fetch2:fetch2:3.0.12"
implementation "com.tonyodev.fetch2okhttp:fetch2okhttp:3.0.12"
api 'com.tonyodev.fetch2:fetch2:3.0.12'
implementation 'com.tonyodev.fetch2okhttp:fetch2okhttp:3.0.12'
}
}