From 30d56fcda1427aac77c4364b6920e36a3e140c48 Mon Sep 17 00:00:00 2001 From: SaeedZhiany Date: Mon, 27 Jan 2020 19:51:21 +0330 Subject: [PATCH] fix(android,build): load Android Gradle Plugin conditionally - Load Android Gradle Plugin conditionally - get project default ext configs from the root project --- android/build.gradle | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index dc5fe65..b7b9779 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,10 +1,16 @@ buildscript { - repositories { - google() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.5.2' + // The Android Gradle plugin is only required when opening the android folder stand-alone. + // This avoids unnecessary downloads and potential conflicts when the library is included as a + // module dependency in an application project. + if (project == rootProject) { + repositories { + google() + jcenter() + } + + dependencies { + classpath("com.android.tools.build:gradle:3.5.3") + } } } @@ -21,7 +27,7 @@ project.ext { compileSdk: 29, // optional as gradle.buildTools comes with one by default // overriding here though to match the version RN uses -// buildTools: "28.0.3" + // buildTools: "29.0.2" ], ], ])