Skip to content

Commit

Permalink
android build: Fix warnings about ignored old build-tools versions.
Browse files Browse the repository at this point in the history
This eliminates the noisiest of the several kinds of
deprecation-warning spew that our third-party dependencies generate --
one set of lines like this (with varying version numbers) for each of
our 11 dependencies:

  WARNING: The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
  Android SDK Build Tools 28.0.3 will be used.
  To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

A couple of other kinds remain.  But now the complete output of
`./gradlew assembleDebug` can fit on a single screen!
  • Loading branch information
gnprice committed Nov 12, 2018
1 parent 83fb558 commit e0b0b97
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,25 @@ allprojects {
}
}
}

// Force all our third-party dependencies to a sensible buildToolsVersion.
// What version should that be? It's whatever the Android plugin applied
// to our app project.
project(":app").afterEvaluate {
ext.buildToolsVersion = it.android.buildToolsVersion
}
allprojects {
if (path != ":" && path != ":app") {
// This line is tricky -- it causes :app to be (sort of?) evaluated,
// so the `project(":app").afterEvaluate` must come first.
evaluationDependsOn(":app")
}
afterEvaluate {
// The plugins for an Android app, library, etc., all pull in
// a common base plugin; look for that to identify Android subprojects
// (where the `android` property will exist.)
if (plugins.any { it.class.name == "com.android.build.gradle.api.AndroidBasePlugin" }) {
android.buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}

0 comments on commit e0b0b97

Please sign in to comment.