I see that jCenter will be decomissioned in the distant future and one is asked to stop using it by Gradle warning. Therefore I have started the transition, and since I saw that simply replacing jcenter() with mavenCentral() resulted in missing dependencies, I opted to add the Maven Central before JCenter as a first start.
AFAIK, Gradle will visit the Maven repos in-order: google, then maven central, then jcenter. But what happens is that when I add it, Gradle is unable to find a dependency:
$ time ./gradlew build --stacktrace
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseKotlin'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find :unspecified:.
Required by:
project :app > project :cameramodule > id.zelory:compressor:2.1.0
...
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
...
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find :unspecified:.
Required by:
project :app > project :cameramodule > id.zelory:compressor:2.1.0
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 15s
Diff
Date: Thu Sep 9 01:46:58 2021 +0200
Prever Maven Central over JCenter repos
diff --git a/build.gradle b/build.gradle
index 6dd00f0..533e262 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,8 +4,8 @@ buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
- jcenter()
-
+ mavenCentral()
+ jcenter() // read-only as of March 2021
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
@@ -25,8 +25,8 @@ buildscript {
allprojects {
repositories {
google()
- jcenter()
-
+ mavenCentral()
+ jcenter() // read-only as of March 2021
}
}