how can I force a library to use sdk build tools 19.1.0 or above without forking/manually editing the build.gradle file for the library?
I keep getting this error when using libraries...
Error:The SDK Build Tools revision (.......) is too low for project ':somelibrary'. Minimum required is 19.1.0
If you only want to update the
compileSdkVersion
andbuildToolsVersion
values only when thebuildToolsVersion
value is too low, you can first compare the version number of the subproject and only update if needed. This way you make minimal changes to other projects and have less projects to check if things go wrong.So, let's say that Android Studio is telling you that you need a minimum build tools version of
25.0.0
, then in your rootbuild.gradle
, here's how you would check each sub-project'sbuildToolsVersion
and only change it if it's less than25.0.0
:The lack easy way to do it is beyond my understanding. Tons of people use library projects that they don't own, have to build with Jenkins or have other reasons not to touch them and don't want to fork them for personal use.
Anyway, I found a solution here.
Will copy it here just in case:
In you root build.gradle add
This will apply compileSdkVersion and buildToolsVersion to any android modules you have.
And in your main project's build.gradle change dependencies to this:
Basically you are defining them once and could use from anywhere.
Cheers.