Browse Source

fix: Android stand-alone build.gradle with .gitignore (#33)

Rapsssito 5 years ago
parent
commit
c1c143bcad
2 changed files with 26 additions and 0 deletions
  1. 2
    0
      .gitignore
  2. 24
    0
      android/build.gradle

+ 2
- 0
.gitignore View File

38
 .gradle
38
 .gradle
39
 local.properties
39
 local.properties
40
 *.iml
40
 *.iml
41
+android/gradle
42
+android/gradlew*
41
 
43
 
42
 # BUCK
44
 # BUCK
43
 buck-out/
45
 buck-out/

+ 24
- 0
android/build.gradle View File

2
   return rootProject.ext.has(name) ? rootProject.ext.get(name) : defaultVaue
2
   return rootProject.ext.has(name) ? rootProject.ext.get(name) : defaultVaue
3
 }
3
 }
4
 
4
 
5
+buildscript {
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.5.0'
16
+        }
17
+    }
18
+}
19
+
5
 apply plugin: 'com.android.library'
20
 apply plugin: 'com.android.library'
6
 
21
 
7
 android {
22
 android {
16
   }
31
   }
17
 }
32
 }
18
 
33
 
34
+repositories {
35
+    google()
36
+    maven {
37
+        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
38
+        url "$rootDir/../node_modules/react-native/android"
39
+    }
40
+    jcenter()
41
+}
42
+
19
 dependencies {
43
 dependencies {
20
   //noinspection GradleDynamicVersion
44
   //noinspection GradleDynamicVersion
21
   implementation 'com.facebook.react:react-native:+'
45
   implementation 'com.facebook.react:react-native:+'