소스 검색

added support of attaching lib as rootProject or as a sub-module

Oleksandr Kucherenko 6 년 전
부모
커밋
e394402499
1개의 변경된 파일25개의 추가작업 그리고 18개의 파일을 삭제
  1. 25
    18
      android/build.gradle

+ 25
- 18
android/build.gradle 파일 보기

@@ -1,41 +1,48 @@
1 1
 buildscript {
2
-    repositories {
3
-        jcenter()
4
-    }
5
-
6
-    dependencies {
7
-        classpath 'com.android.tools.build:gradle:2.3.0'
2
+    /* In case of submodule usage, do not try to apply own repositories and plugins,
3
+        root project is responsible for that. */
4
+    if (rootProject.buildDir == project.buildDir) {
5
+        repositories {
6
+            google()
7
+            jcenter()
8
+        }
9
+        dependencies {
10
+            classpath 'com.android.tools.build:gradle:2.3.0'
11
+        }
8 12
     }
9 13
 }
10 14
 
11 15
 apply plugin: 'com.android.library'
12 16
 
13 17
 android {
14
-    compileSdkVersion 26
15
-    buildToolsVersion "26.0.1"
18
+    compileSdkVersion 27
19
+    buildToolsVersion "28.0.3"
16 20
 
17 21
     defaultConfig {
18 22
         minSdkVersion 16
19
-        targetSdkVersion 26
23
+        targetSdkVersion 27
24
+
20 25
         versionCode 1
21 26
         versionName "1.0"
22 27
     }
28
+
23 29
     lintOptions {
24 30
         abortOnError false
25 31
     }
26 32
 }
27 33
 
28
-allprojects {
29
-    repositories {
30
-        mavenLocal()
31
-        jcenter()
32
-        maven {
33
-            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
34
-            url "$rootDir/../node_modules/react-native/android"
35
-        }
34
+repositories {
35
+    google()
36
+    jcenter()
37
+    mavenLocal()
38
+    maven {
39
+        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
40
+        url "$rootDir/../node_modules/react-native/android"
36 41
     }
37 42
 }
38 43
 
39 44
 dependencies {
40
-    compile 'com.facebook.react:react-native:+'
45
+    implementation 'com.android.support:support-v4:27.+'
46
+
47
+    api 'com.facebook.react:react-native:+'
41 48
 }