Skip to content

Commit 04b456d

Browse files
authored
Merge pull request #54 from matinzd/patch-1
fix: make android gradle safe by adding safeExtGet
2 parents 10a1f32 + ad3c204 commit 04b456d

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

android/build.gradle

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,58 @@
1-
def safeExtGet(prop, fallback) {
2-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
1+
buildscript {
2+
if (project == rootProject) {
3+
repositories {
4+
google()
5+
jcenter()
6+
}
7+
8+
dependencies {
9+
classpath 'com.android.tools.build:gradle:3.5.3'
10+
}
11+
}
312
}
413

514
apply plugin: 'com.android.library'
615

7-
android {
8-
compileSdkVersion safeExtGet('compileSdkVersion', 28)
9-
buildToolsVersion safeExtGet('buildToolsVersion', "28.0.3")
16+
def safeExtGet(prop, fallback) {
17+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
18+
}
1019

20+
android {
21+
compileSdkVersion safeExtGet('compileSdkVersion', 29)
22+
buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2')
1123
defaultConfig {
1224
minSdkVersion safeExtGet('minSdkVersion', 16)
13-
targetSdkVersion safeExtGet('targetSdkVersion', 28)
25+
targetSdkVersion safeExtGet('targetSdkVersion', 29)
1426
versionCode 1
1527
versionName "1.0"
16-
ndk {
17-
abiFilters "armeabi-v7a", "x86"
28+
29+
}
30+
31+
buildTypes {
32+
release {
33+
minifyEnabled false
1834
}
1935
}
2036
lintOptions {
21-
warning 'InvalidPackage'
37+
disable 'GradleCompatible'
38+
}
39+
compileOptions {
40+
sourceCompatibility JavaVersion.VERSION_1_8
41+
targetCompatibility JavaVersion.VERSION_1_8
2242
}
2343
}
2444

25-
dependencies {
26-
implementation 'com.facebook.react:react-native:+'
45+
repositories {
46+
mavenLocal()
47+
maven {
48+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
49+
url("$rootDir/../node_modules/react-native/android")
50+
}
51+
google()
52+
jcenter()
2753
}
2854

55+
dependencies {
56+
//noinspection GradleDynamicVersion
57+
implementation "com.facebook.react:react-native:+" // From node_modules
58+
}

0 commit comments

Comments
 (0)