Skip to content

Commit eb101ad

Browse files
authored
🐛 Remove jcenter / use modern versions (#30)
* fix(android, build): remove jcenter / use modern versions * fix(android): use default versions with wider compatibility Android gradle plugin of 7.0.3 requires a minimum gradle of 7 which it turns out many don't have If you do have gradle 7 though, you may have a compatibility issue with Java 8 Sticking to gradle plugin 4 for a bit, and compile version 30 (rapidly becoming most common) should yield maximum compatibility
1 parent 72300fa commit eb101ad

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

android/build.gradle

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
21
buildscript {
3-
repositories {
4-
jcenter()
5-
}
6-
7-
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.3.1'
2+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
3+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
4+
// module dependency in an application project.
5+
if (project == rootProject) {
6+
repositories {
7+
mavenCentral()
8+
google()
9+
}
10+
def buildGradleVersion = ext.has('buildGradlePluginVersion') ? ext.get('buildGradlePluginVersion') : '4.2.2'
11+
12+
dependencies {
13+
classpath "com.android.tools.build:gradle:$buildGradleVersion"
14+
}
915
}
1016
}
1117

@@ -16,12 +22,12 @@ def safeExtGet(prop, fallback) {
1622
}
1723

1824
android {
19-
compileSdkVersion safeExtGet('compileSdkVersion', 26)
20-
buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')
25+
compileSdkVersion safeExtGet('compileSdkVersion', 30)
26+
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.3')
2127

2228
defaultConfig {
2329
minSdkVersion safeExtGet('minSdkVersion', 16)
24-
targetSdkVersion safeExtGet('targetSdkVersion', 26)
30+
targetSdkVersion safeExtGet('targetSdkVersion', 30)
2531
versionCode 1
2632
versionName "1.0"
2733
}
@@ -32,6 +38,11 @@ android {
3238

3339
repositories {
3440
mavenCentral()
41+
google()
42+
maven {
43+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
44+
url "$rootDir/../node_modules/react-native/android"
45+
}
3546
}
3647

3748
dependencies {

0 commit comments

Comments
 (0)