Skip to content

Commit 9c0d1b1

Browse files
Fix build.gradle setup
1 parent 1e66d6f commit 9c0d1b1

File tree

4 files changed

+4221
-49
lines changed

4 files changed

+4221
-49
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ indent_style = space
77
insert_final_newline = true
88
trim_trailing_whitespace = true
99

10+
[*.gradle]
11+
indent_size = 4
12+
1013
[*.md]
1114
trim_trailing_whitespace = false

android/build.gradle

+41-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,50 @@
1-
apply plugin: 'com.android.library'
2-
31
def safeExtGet(prop, fallback) {
4-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
2+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
53
}
64

7-
android {
8-
compileSdkVersion safeExtGet('compileSdkVersion', 28)
9-
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
5+
buildscript {
6+
repositories {
7+
google()
8+
jcenter()
9+
}
10+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
11+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
12+
// module dependency in an application project.
13+
if (project == rootProject) {
14+
dependencies {
15+
classpath 'com.android.tools.build:gradle:3.5.0'
16+
}
17+
}
18+
}
1019

11-
defaultConfig {
12-
minSdkVersion safeExtGet('minSdkVersion', 16)
13-
targetSdkVersion safeExtGet('targetSdkVersion', 28)
14-
}
20+
apply plugin: 'com.android.library'
21+
22+
android {
23+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
24+
defaultConfig {
25+
minSdkVersion safeExtGet('minSdkVersion', 16)
26+
targetSdkVersion safeExtGet('targetSdkVersion', 28)
27+
}
28+
lintOptions {
29+
abortOnError false
30+
}
31+
}
1532

16-
lintOptions {
17-
abortOnError false
18-
}
33+
repositories {
34+
mavenLocal()
35+
maven {
36+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
37+
url "$rootDir/../node_modules/react-native/android"
38+
}
39+
maven {
40+
// Android JSC is installed from npm
41+
url "$rootDir/../node_modules/jsc-android/dist"
42+
}
43+
google()
44+
jcenter()
1945
}
2046

2147
dependencies {
22-
implementation 'com.facebook.react:react-native:+'
48+
//noinspection GradleDynamicVersion
49+
implementation 'com.facebook.react:react-native:+' // From node_modules
2350
}

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@
3232
"react-native": ">=0.56.0"
3333
},
3434
"devDependencies": {
35+
"@babel/core": "^7.6.0",
3536
"flow-bin": "0.98.0",
3637
"husky": "3.0.5",
3738
"lint-staged": "9.2.5",
38-
"prettier": "1.18.2"
39+
"prettier": "1.18.2",
40+
"react": "16.8.6",
41+
"react-native": "0.60.5"
3942
}
4043
}

0 commit comments

Comments
 (0)