Android: Could not find method implementation() for arguments

I’ve been trying to update Gradle in my React Native PDF repository from the quite old version 2.2, to version 7.3, when I got the error Could not find method implementation() for arguments.

I’ve tried searching online and testing several suggestions, but most of them didn’t work.
Only after I’ve decided to update the, now deprecated JCenter repository, I’ve found the solution to this problem.

I’ve replaced jcenter() in my gradle.build file with mavenCentral(), like this:

1
2
3
4
5
6
7
8
9
buildscript {
repositories {
mavenCentral()
}

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

Thinking that the maven central is the de-facto standard for Java packages, I hoped everything will work correctly with the current setup.
However I kept getting the same error.
When I checked the maven central, I’ve found that the last build for android tools was from 2017!
Obviously, that would not be compatible with the lastest Gradle.

It looks like Google have stopped updating the Maven repository and this package should now be downloaded from their own - Google repository.
After updating the gradle.build with the following settings, the error was resolved:

1
2
3
4
5
6
7
8
9
buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
Setting up a rootless Docker server (with Ansible) and deploying an application.

Comments