Skip to content

Load Android Gradle Plugin conditionally #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def getPackageVersion() {
}

def safeExtGet(prop, fallback) {
return rootProject.ext.hasProperty(prop) ? rootProject.ext.get(prop) : fallback
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def _buildToolsVersion = safeExtGet('buildToolsVersion', '28.0.3')
Expand All @@ -14,12 +14,18 @@ def _targetSdkVersion = safeExtGet('targetSdkVersion', 28)
def _minSdkVersion = safeExtGet('minSdkVersion', 16)

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// 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")
}
}
}

Expand Down