Skip to content

Commit 0fe0f8d

Browse files
Update build.gradle setup
1 parent 75ca7f8 commit 0fe0f8d

File tree

3 files changed

+40
-24
lines changed

3 files changed

+40
-24
lines changed

.gitignore

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
#
44
.DS_Store
55

6-
# node.js
7-
#
8-
node_modules/
9-
npm-debug.log
10-
yarn-error.log
11-
12-
136
# Xcode
147
#
158
build/
@@ -29,7 +22,6 @@ DerivedData
2922
*.ipa
3023
*.xcuserstate
3124
project.xcworkspace
32-
3325

3426
# Android/IntelliJ
3527
#
@@ -38,11 +30,20 @@ build/
3830
.gradle
3931
local.properties
4032
*.iml
33+
android/gradle/
34+
android/gradlew
35+
android/gradlew.bat
36+
37+
# node.js
38+
#
39+
node_modules/
40+
npm-debug.log
41+
yarn-error.log
4142

4243
# BUCK
4344
buck-out/
4445
\.buckd/
4546
*.keystore
4647

4748
# Editor config
48-
.vscode
49+
.vscode

android/build.gradle

+30-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
def safeExtGet(prop, fallback) {
2+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
3+
}
14

25
buildscript {
36
repositories {
47
google()
58
jcenter()
69
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.4.1'
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.4.1'
16+
}
1017
}
1118
}
1219

@@ -37,22 +44,34 @@ def useDedicatedExecutor = rootProject.hasProperty('AsyncStorage_dedicatedExecut
3744
apply plugin: 'com.android.library'
3845

3946
android {
40-
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
41-
buildToolsVersion getExtOrDefault('buildToolsVersion')
42-
47+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
48+
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
4349
defaultConfig {
44-
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
45-
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
46-
50+
minSdkVersion safeExtGet('minSdkVersion', 19)
51+
targetSdkVersion safeExtGet('targetSdkVersion', 28)
4752
buildConfigField "Long", "AsyncStorage_db_size", "${dbSizeInMB}L"
4853
buildConfigField("boolean", "AsyncStorage_useDedicatedExecutor", "${useDedicatedExecutor}")
4954
}
55+
lintOptions {
56+
abortOnError false
57+
}
5058
}
5159

5260
repositories {
53-
mavenCentral()
61+
mavenLocal()
62+
maven {
63+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
64+
url "$rootDir/../node_modules/react-native/android"
65+
}
66+
maven {
67+
// Android JSC is installed from npm
68+
url "$rootDir/../node_modules/jsc-android/dist"
69+
}
70+
google()
71+
jcenter()
5472
}
5573

5674
dependencies {
57-
implementation 'com.facebook.react:react-native:+'
75+
//noinspection GradleDynamicVersion
76+
implementation 'com.facebook.react:react-native:+' // From node_modules
5877
}

android/gradle.properties

-4
This file was deleted.

0 commit comments

Comments
 (0)