From 5e7f9f58ec5609d4ac3667677c0306932adc5c43 Mon Sep 17 00:00:00 2001 From: Jeremy Jonas Date: Thu, 10 Feb 2022 19:30:01 +0700 Subject: [PATCH] fix(android): Use root project build sdk version (#23) https://github.com/bebnev/react-native-user-agent/issues/20 Explicitly setting these build values causes incompatible SDKs versions to fail with `Execution failed for task ':react-native-user-agent:verifyReleaseResources'.` Fixes #20 --- android/build.gradle | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 38ec22e..fcd8b2e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,3 +1,6 @@ +def safeExtGet(prop, fallback) { + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback +} buildscript { repositories { @@ -12,15 +15,16 @@ buildscript { apply plugin: 'com.android.library' android { - compileSdkVersion 27 - buildToolsVersion "27.0.3" + compileSdkVersion safeExtGet('compileSdkVersion', 27) + buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3') defaultConfig { - minSdkVersion 16 - targetSdkVersion 22 + minSdkVersion safeExtGet('minSdkVersion', 16) + targetSdkVersion safeExtGet('targetSdkVersion', 22) versionCode 1 versionName "1.0" } + lintOptions { abortOnError false } @@ -33,4 +37,3 @@ repositories { dependencies { compile 'com.facebook.react:react-native:+' } -