Android Studio Build.Gradle Warning Message

Android Studio build.gradle warning message

The problem lies in apply plugin: ''

The Google Services plugin is adding a dependency on behalf of you. Hopefully they fix it in the future.

Can't get rid of build.gradle deprecated-warnings that aren't true ('compile')

Let's review the difference from API and compile:

  • Implementation:

When your module configures an implementation dependency, it's letting Gradle know that the module does not want to leak the dependency to other modules at compile time. That is, the dependency is available to other modules only at runtime.

  • API

When a module includes an api dependency, it's letting Gradle know that the module wants to transitively export that dependency to other modules, so that it's available to them at both runtime and compile time.


API behaves exactly like compile did. If you don't want to bother with implementation, use API.

Implementation is a bit trickier and iirc it will only allow your dependencies to be used at runtime and not compile time. You can remplace the imports by implementation, and if the project fails building, replace it by api.

The warning is likely from a dependency you have, that in turns also has dependencies, which are referred as compile. Try to update the version of your dependencies, maybe you are using an older version that has not updated their gradle build file.

How to solve Android Studio warning Error?

it's your code warning. it's showing because google will remove 'compile' support after 2019. It is giving you warning if you are using it please replace it with 'implementation'. So if you are not using 'compile' then you do not need to worry about this warning.

How does adding ( ) change the gradle warning message?

based on what it says here it seems like adding the () is meant for providing a justification for using that specific verison and can be used like so:

implementation('org.ow2.asm:asm:6.0') {
because 'we require a JDK 9 compatible bytecode generator'

So the warning is likely going away because it thinks you have a good reason for using that version

build.gradle warning 'avoid using + in version numbers'

Someday, someone else may do a git pull on your code and then try build an apk. This apk may have different behavior or even get a build error or run time error, because the dependencies version can be different than the dependencies used when you created this code.

You should use an explicit dependency version. I suggest use the newest version. You can search on bintray jcenter to see the newest version. If you are using Android Studio, File -> Project Structure -> Modules -> (your module, app usually) -> Dependencies -> Add library dependency (click the + sign) will give you the newest version, even add library automatically.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0

Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.

It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.

Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.

build.gradle file errors and warnings after upgrade to Android Studio 1.5.1

Yes, messages like ...cannot be applied to groovy.lang.Closure can be ignored, but if you want to fix them here are a few answers that will help you:

Quick fix - just a small change in settings.

Proper and lengthy fix - creating a top level build.gradle.

Missed this earlier but thanks to Gabriele for pointing it out in the comment below:

The warning about the api to be used to compile the project, should
not be ignored. You have to compile with the same version of the maior
release (in this case 22) otherwise you can have issue. For example
using the appcompat v22 you would have errors using api 19

Related Topics

Leave a reply