Skip to content

Commit 5568e4c

Browse files
Update build.gradle setup
1 parent 75ca7f8 commit 5568e4c

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
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-23
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1+
def safeExtGet(prop, fallback) {
2+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
3+
}
14

25
buildscript {
3-
repositories {
4-
google()
5-
jcenter()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.4.1'
6+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
7+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
8+
// module dependency in an application project.
9+
if (project == rootProject) {
10+
repositories {
11+
google()
12+
jcenter()
13+
}
14+
dependencies {
15+
classpath 'com.android.tools.build:gradle:3.4.1'
16+
}
1017
}
1118
}
1219

13-
def getExtOrDefault(name) {
14-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNAsyncStorage_' + name]
15-
}
16-
17-
def getExtOrIntegerDefault(name) {
18-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RNAsyncStorage_' + name]).toInteger()
19-
}
20-
2120
// AsyncStorage has default size of 6MB.
2221
// This is a sane limit to protect the user from the app storing too much data in the database.
2322
// This also protects the database from filling up the disk cache and becoming malformed.
@@ -37,22 +36,30 @@ def useDedicatedExecutor = rootProject.hasProperty('AsyncStorage_dedicatedExecut
3736
apply plugin: 'com.android.library'
3837

3938
android {
40-
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
41-
buildToolsVersion getExtOrDefault('buildToolsVersion')
42-
39+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
40+
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
4341
defaultConfig {
44-
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
45-
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
46-
42+
minSdkVersion safeExtGet('minSdkVersion', 19)
43+
targetSdkVersion safeExtGet('targetSdkVersion', 28)
4744
buildConfigField "Long", "AsyncStorage_db_size", "${dbSizeInMB}L"
4845
buildConfigField("boolean", "AsyncStorage_useDedicatedExecutor", "${useDedicatedExecutor}")
4946
}
47+
lintOptions {
48+
abortOnError false
49+
}
5050
}
5151

5252
repositories {
53-
mavenCentral()
53+
mavenLocal()
54+
maven {
55+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
56+
url "$rootDir/../node_modules/react-native/android"
57+
}
58+
google()
59+
jcenter()
5460
}
5561

5662
dependencies {
57-
implementation 'com.facebook.react:react-native:+'
63+
//noinspection GradleDynamicVersion
64+
implementation 'com.facebook.react:react-native:+' // From node_modules
5865
}

android/gradle.properties

-4
This file was deleted.

0 commit comments

Comments
 (0)