Skip to content

Commit 696d9eb

Browse files
authored
Load Android Gradle Plugin conditionally
1 parent b7c722a commit 696d9eb

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

android/build.gradle

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ def _targetSdkVersion = safeExtGet('targetSdkVersion', 28)
1414
def _minSdkVersion = safeExtGet('minSdkVersion', 16)
1515

1616
buildscript {
17-
repositories {
18-
google()
19-
jcenter()
20-
}
21-
dependencies {
22-
classpath 'com.android.tools.build:gradle:3.4.1'
17+
// The Android Gradle plugin is only required when opening the android folder stand-alone.
18+
// This avoids unnecessary downloads and potential conflicts when the library is included as a
19+
// module dependency in an application project.
20+
if (project == rootProject) {
21+
repositories {
22+
google()
23+
jcenter()
24+
}
25+
26+
dependencies {
27+
//noinspection GradleDependency
28+
classpath("com.android.tools.build:gradle:3.5.3")
29+
}
2330
}
2431
}
2532

0 commit comments

Comments
 (0)