Gradle – Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]

We Are Going To Discuss About Gradle – Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]. So lets Start this Java Article.

Gradle – Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]

  1. Gradle – Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]

    Make sure your Gradle version is 3.*.* or higher before using “implementation”.
    Open the project level Gradle file under dependencies:
    dependencies{ classpath 'com.android.tools.build:gradle:3.1.2' }

  2. Gradle – Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]

    Make sure your Gradle version is 3.*.* or higher before using “implementation”.
    Open the project level Gradle file under dependencies:
    dependencies{ classpath 'com.android.tools.build:gradle:3.1.2' }

Solution 1

Replace compile with implementation.

compile was recently deprecated and replaced by implementation or api

Advertisements

Original Author Saurabh Thorat Of This Content

Solution 2

Make sure you’re adding these dependencies in android/app/build.gradle, not android/build.gradle

Advertisements

Original Author Sunil Kumar Of This Content

Solution 3

Make sure your Gradle version is 3.*.* or higher before using “implementation”.

Open the project level Gradle file under dependencies:

dependencies{
    classpath 'com.android.tools.build:gradle:3.1.2'
}

Open the ‘gradle-wrapper.properties’ file and set the distributionUrl:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

or latest version.

Sync the project. I Hope this solves your problem.

Advertisements

Original Author krishnamurthy Of This Content

Solution 4

You need to use at least Gradle 3.4 or newer to be able to use implementation. It is not recommended to keep using the deprecated compile since this can result in slower build times. For more details see the official android developer guide:

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.
Using this dependency configuration instead of api or compile can result in significant build time improvements because it reduces the amount of projects that the build system needs to recompile. For example, if an implementation dependency changes its API, Gradle recompiles only that dependency and the modules that directly depend on it. Most app and test modules should use this configuration.

https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations

Update: compile will be removed by end of 2018, so make sure that you use only implementation now:

Warning:Configuration ‘compile’ is obsolete and has been replaced with
‘implementation’. It will be removed at the end of 2018

Advertisements

Original Author donfuxx Of This Content

Conclusion

Advertisements

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment