60

In Android Studio 3, I'm seeing this issue:

The specified Android SDK Build Tools version (26.0.0) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.0.

Android SDK Build Tools 26.0.2 will be used.

To suppress this warning, remove "buildToolsVersion '26.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

The problem is that because these are third-party/vendor modules that have buildToolsVersion '26.0.0', I can't modify their build.gradle without forking each submodule.

Is there a way to set a global buildToolsVersion that will override all the sub build.gradles?

Snowman
  • 31,411
  • 46
  • 180
  • 303
  • 2
    Looks like it's doing it for you? – natario Nov 06 '17 at 22:13
  • It's not. It says it's a "warning", but it's coming up as an error and halting the build process. – Snowman Nov 06 '17 at 22:15
  • Please update your SDK and set gradle to 27.0.1, now say `distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip` (gradle-wrapper in gradle-dir) a try. Next delete both build-dirs and rebuild.. – Martin Pfeffer Nov 06 '17 at 22:16
  • 1
    You can drop back to `com.android.tools.build:gradle:2.3.3`. You'll get the "convert this project" dialog again, which you can either keep ignoring or tell it to stop nagging you. – CommonsWare Nov 06 '17 at 22:20
  • Just use a global var and change the buildToolsVersion in the build.gradle file of the third-party libraries. – Gabriele Mariotti Nov 07 '17 at 06:07
  • Did you manage to fix this? – Mohamed Oun Nov 27 '17 at 11:19
  • @MohamedOun see the fix below. – Varun Bhatia Dec 24 '17 at 12:35
  • @Snowman I encountered the same issue, resolved by adding following snippet to the root build.gradle subprojects { ... afterEvaluate { subproject -> if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { android { buildToolsVersion "26.0.2" } } } } – Kanishka Mar 27 '18 at 17:42

8 Answers8

17

Here if you are referring to my previous answers Here is an Update. 1. Compile would be removed from the dependencies after 2018.

a new version build Gradle is available.

enter image description here

Use the above-noted stuff it will help you to resolve the errors. It is needed for the developers who are working after March 2018. Also, maven update might be needed. All above answers will not work on the Android Studio 3.1. Hence Above code block is needed to be changed if you are using 3.1. See also I replaced compile by implementation.

Rahul Joshi
  • 263
  • 3
  • 10
  • 1
    This is the latest answer, and the one that should be used. It worked for me, to use sdk version 27! – Leonardo Alves Machado May 03 '18 at 13:49
  • I am using 3.1. Do you mean to say make these changes in build Gradle in all modules or only for module app? (OP is also saying `I can't modify their build.gradle` for third-party/vendor modules) – Atul Aug 17 '18 at 14:37
  • @Atul When making a new app on 3.1.3 or greater. I have seen the android studio generally making all changes as I mentioned above but when we import projects via Github generally API versions are of a lower level Hence we have to make changes in the Build.gradle file (Module: app) with Dependencies changes also to be done. As part of question stated Answer is YES only in Module: App. (Build.gradle) & we generally are not doing anything in other modules as per the original topic question so as to build & sync gradle project in Android Studio. Hope I am clear in explaining. – Rahul Joshi Aug 17 '18 at 16:50
  • One new problem might appear No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android. So Please look after that situation. – Rahul Joshi Oct 26 '18 at 21:44
  • 1
    @RahulJoshi I had the same problem like: "No toolchains found in the NDK toolchains folder...". Look this answer. I have fixed it: https://stackoverflow.com/questions/35128229/error-no-toolchains-found-in-the-ndk-toolchains-folder-for-abi-with-prefix-llv/52454806#52454806 – V.March Oct 31 '18 at 11:24
  • @V.March Thanks, I was so frustrated as Gradle build was not happening which lead to the non-responsive Android studio (Non-Editable & Debuggable code) – Rahul Joshi Nov 01 '18 at 14:01
13

Open app/build.gradle file

Change buildToolsVersion to buildToolsVersion "26.0.2"

change compile 'com.android.support:appcompat to compile 'com.android.support:appcompat-v7:26.0.2'

Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146
hindawisyr
  • 131
  • 1
  • 3
7

Solution to this problem is simple

Go to build.gradle (module.app) file

Change the Build Version for app as shown in the photo link

It will help us to rebuild gradle for the project, to make it sync again.

Rahul Joshi
  • 263
  • 3
  • 10
6

Update to Android Studio 3.0.1 which treats these as warnings. Android 3.0 was treating such warnings as errors and hence causing the gradle sync operation to fail.

Varun Bhatia
  • 4,326
  • 32
  • 46
3

Set the buildToolsVersion '26.0.2' then change classpath 'com.android.tools.build:gradle:3.0.1'.

Make sure you set compileSdkVersion to 26 whiles targetSdkVersion is also set 26.

It is also appropriate to sent set compile 'com.android.support:appcompat-v7:26.0.2'.

Dima Kozhevin
  • 3,602
  • 9
  • 39
  • 52
Lee Chu
  • 41
  • 3
1

just clean and make project / rebuilt fixed my issue give a try :-)

Jasbin karki
  • 127
  • 2
  • 8
1

invalidate cache in android studio will resolve this issue. Go to file-> click on invalidate cache/restart option.

Shree
  • 11
  • 2
0

Many times as API's are updated. We forgot to update SDK Managers. For accessing recent API's one should always have highest API Level updated if possible should also have other regularly used lower level APIs to accommodate backward compatibility.
Go to build.gradle (module.app) file change compileSdkVersion buildToolsVersion targetSdkVersion, all should have the highest level of API.

Rahul Joshi
  • 263
  • 3
  • 10