Created
July 2, 2019 20:02
-
-
Save Dimon70007/238a7a0371183c6ed4bea8a97bef6437 to your computer and use it in GitHub Desktop.
sample build.gradle for library. that uses buildGradle version from root project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def safeExtGet(prop, fallback) { | |
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | |
} | |
buildscript { | |
repositories { | |
maven { | |
url 'https://maven.google.com/' | |
name 'Google' | |
} | |
jcenter() | |
google() | |
} | |
def buildGradleVersion = ext.has('buildGradlePluginVersion') ? ext.get('buildGradlePluginVersion') : '3.4.0' | |
dependencies { | |
classpath "com.android.tools.build:gradle:$buildGradleVersion" | |
} | |
} | |
apply plugin: 'com.android.library' | |
def _reactNativeVersion = safeExtGet('reactNative', '+') | |
def _compileSdkVersion = safeExtGet('compileSdkVersion', 27) | |
def _buildToolsVersion = safeExtGet('buildToolsVersion', '27.0.3') | |
def _minSdkVersion = safeExtGet('minSdkVersion', 16) | |
def _targetSdkVersion = safeExtGet('targetSdkVersion', 27) | |
android { | |
compileSdkVersion _compileSdkVersion | |
buildToolsVersion _buildToolsVersion | |
defaultConfig { | |
minSdkVersion _minSdkVersion | |
targetSdkVersion _targetSdkVersion | |
versionCode 1 | |
versionName "1.0" | |
} | |
lintOptions { | |
abortOnError false | |
} | |
} | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
implementation "com.facebook.react:react-native:${_reactNativeVersion}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment