|
1 | | -apply plugin: 'com.android.library' |
2 | | - |
3 | 1 | def safeExtGet(prop, fallback) { |
4 | | - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback |
| 2 | + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback |
| 3 | +} |
| 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 | + } |
5 | 18 | } |
6 | 19 |
|
| 20 | +apply plugin: 'com.android.library' |
| 21 | + |
7 | 22 | android { |
8 | | - compileSdkVersion safeExtGet('compileSdkVersion', 28) |
9 | | - buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') |
10 | | - defaultConfig { |
11 | | - minSdkVersion safeExtGet('minSdkVersion', 16) |
12 | | - targetSdkVersion safeExtGet('targetSdkVersion', 28) |
13 | | - } |
14 | | - lintOptions { |
15 | | - abortOnError false |
16 | | - } |
| 23 | + compileSdkVersion safeExtGet('compileSdkVersion', 28) |
| 24 | + buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') |
| 25 | + defaultConfig { |
| 26 | + minSdkVersion safeExtGet('minSdkVersion', 16) |
| 27 | + targetSdkVersion safeExtGet('targetSdkVersion', 28) |
| 28 | + } |
| 29 | + lintOptions { |
| 30 | + abortOnError false |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +repositories { |
| 35 | + mavenLocal() |
| 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 | + maven { |
| 41 | + // Android JSC is installed from npm |
| 42 | + url "$rootDir/../node_modules/jsc-android/dist" |
| 43 | + } |
| 44 | + google() |
| 45 | + jcenter() |
17 | 46 | } |
18 | 47 |
|
19 | 48 | dependencies { |
20 | | - // noinspection GradleDynamicVersion |
21 | | - api 'com.facebook.react:react-native:+' |
| 49 | + //noinspection GradleDynamicVersion |
| 50 | + implementation 'com.facebook.react:react-native:+' // From node_modules |
22 | 51 | } |
0 commit comments