Gradle: Could not resolve com.squareup.okhttp3:okhttp:3.12.+ - gradle

Since today, and I didn't change anything in my Gradle files, there is an error during the building:
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.squareup.okhttp3:okhttp:3.12.+.
For information in my Gradle:
allprojects {
repositories {
google()
mavenCentral()
// jcenter()
maven { url = "https://jcenter.bintray.com" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven { url "https://dl.cloudsmith.io/public/cometchat/cometchat-pro-android/maven/" }
flatDir {
dirs 'src/main/libs'
}
}
}

According to gradle status, jcenter has some issues still.

Related

Could not find com.github.searchy2:CustomButton:1.9.0. ERROR

My build.gradle file looks like this:
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
maven { url 'https://plugins.gradle.org/m2/' }
jcenter() // Warning: this repository is going to shut down soon
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ERROR
Could not find com.github.searchy2:CustomButton:1.9.0.
Required by:
project :app > com.github.searchy2:CustomPermissionsDialogue:2.2.1

Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0

I have created the account and key needed from Mapbox. I have listed the repositories in different order with no luck. Whn building, the following error appears:
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
Required by:
project :app > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1
Here's my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.20"
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I've added the following to my module level build.gradle
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1'
I have only added jcenter() and it works. However, jcenter() is deprecated.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
It seem like they remove mapbox-android-accounts repository.
Check this: https://mvnrepository.com/artifact/com.mapbox.mapboxsdk/mapbox-android-accounts/0.8.0
Github page is empty.
Works for me after jcenter() added.
I added jcenter() to buildscript -> repositories and allprojects -> repositories:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username "mapbox"
password "YOUR_TOKEN"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}

Gradle | Configuration with name 'complileClasspath' not found. for multi-level project build

I am trying to build a multi-project build in Gradle using Kotlin DSL.
Root build.gradle.kts:
allprojects {
repositories {
jcenter()
google()
}
}
subprojects{
version = "1.0"
}
plugins {
java
application
}
repositories {
jcenter()
}
dependencies {
implementation("com.google.guava:guava:27.0.1-jre")
testImplementation("junit:junit:4.12")
}
application {
mainClassName = "gradle.youtube.series.App"
}
gitutils subproject's build.gradle.kts
plugins {
`java-library`
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.sl4j:sl4j-api:1.7.2")
implementation("org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r")
testImplementation("org.junit.jupiter:junit-jupiter:5.4.1")
testRuntimeOnly("org.sl4j:sl4j-simple:1.7.2")
}
tasks.test {
useJUnitPlatform()
}
I am trying to download gradeutil's dependencies using the following command:
./gradlew gitutils:dependencies --configuration complileClasspath
I am getting the following error:
Configuration with name 'complileClasspath' not found.
Is compileClassPath required for multi-level gradle project? What is its use?

gradle overwrite plugin repository from init script

How can I overwrite all plugin repositories in gradle via the init script?
allprojects {
repositories {
maven { url "foo" }
}
}
only works for regular repositories - not for plugin repositories.
Plugins are registerd via the old buildscript{ repositories { }} notation
simply adding:
allprojects {
buildscript{
repositories{
maven { url "https://foo.com" }
}
}
repositories {
maven { url "https://foo.com" }
}
}
is the solution

Multiple maven repositories in one gradle file

So my problem is how to add multiple maven repositories to one gradle file.
This DOESN’T work:
repositories {
mavenCentral()
maven {
url "http://maven.springframework.org/release"
url "http://maven.restlet.org"
}
}
you have to do like this in your project level gradle file
allprojects {
repositories {
jcenter()
maven { url "http://dl.appnext.com/" }
maven { url "https://maven.google.com" }
}
}

Resources