Android Studio 3.1 : Could not find org.jetbrains.trove4j:trove4j:20160824
Asked Answered
M

4

27

Yesterday, I updated Android Studio to 3.1 and I'm getting this error :

 Could not find org.jetbrains.trove4j:trove4j:20160824.
Searched in the following locations:
    https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
    https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
    https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
Required by:
    project :library > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.lint:lint:26.0.1 > com.android.tools.lint:lint-checks:26.0.1 > com.android.tools.lint:lint-api:26.0.1 > com.android.tools.external.com-intellij:intellij-core:26.0.1

This is my project's gradle file :

    buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
//        classpath 'com.google.gms:google-services:1.5.0-beta2'
        classpath 'com.google.gms:google-services:3.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }

        maven {
            url 'https://maven.google.com/'

        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

This is my gradle-wrapper-properties's distdistributionUrl:

distdistributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
Microtone answered 30/3, 2018 at 10:59 Comment(1)
Error says it isn't searching jcenterCochise
F
57

Try to replace all occurences of mavenCentral() with jcenter() in your gradle builds

Fireboard answered 5/4, 2018 at 9:21 Comment(5)
I just replace the root gradle's allprojects node. It's work for me !Thank you !Timothee
Could not find org.jetbrains.trove4j:trove4j:20160824. Searched in the following locations: - repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/…Archbishopric
Perfect! It worked for me. I'm just curious, how do you know about it?Gene
This is no longer valid as jcenter is sunsetting May 1st 2021Ragwort
@ElliotM, yes. See my answer below for Maven.Melisa
M
19

Because jCenter will close in May, you should replace it with Maven. Thanks to giorgos.nl now we can add Trove4j:20160824. Thanks to Xavier Rubio Jansana we can replace maven { url 'https://plugins.gradle.org/m2/' } with gradlePluginPortal().

In root build.gradle write:

buildscript {
    repositories {
        google()
        gradlePluginPortal()
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        // org.jetbrains.trove4j:trove4j:20160824.
        gradlePluginPortal()
    }
}

To add libraries that have not still been moved to mavenCentral, use this method.

Root build.gradle:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Then you should search GitHub repositories of not resolved libraries. App's build.gradle example with two libraries:

dependencies {
    // When a library has tags.
    implementation 'com.github.RedMadRobot:input-mask-android:6.0.0'
    // When a library doesn't have tags.
    implementation 'com.github.savvisingh:DateRangePicker:master'
}

Now we can launch an application and build apk without errors.

Melisa answered 12/2, 2021 at 8:34 Comment(3)
http://maven.aliyun.com/nexus/content/groups/public/ is on Alibaba cloud. If you have concerns about China, you can use instead https://plugins.gradle.org/m2/ to get trove4j:trove4jSinglephase
maven {url 'https://plugins.gradle.org/m2/' } can be replaced by the shortcut gradlePluginPortal() when using Gradle 6 or newer.Debate
@XavierRubioJansana, thank you very much! I added your advice.Melisa
M
10

I had the same mistake ... and for me the following worked:

  1. Add jcenter() to repositories {} of allprojects
  2. And add compile 'org.jetbrains.trove4j: trove4j: 20160824' in the build.gradle app module
Mumble answered 1/4, 2018 at 21:25 Comment(0)
C
0

I had this same error. I also had jcentre() at the appropriate place. But still it was not working. One thing you can do which worked for me is clear the caches:

1. Close Android Studio.

2. Clear caches in here:

C:\Users"username"\.android\caches

C:\Users"username"\.gradle\caches

3. Open Android Studio.

Also make sure you have the version of the gradle which is newer than the minimum required.

Coburg answered 13/10, 2020 at 9:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.