Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 743
Fadwa Bechri Avatar asked Mar 30 '18 10:03

Fadwa Bechri


3 Answers

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

like image 113
Taher Mestiri Avatar answered Oct 24 '22 00:10

Taher Mestiri


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.

like image 24
CoolMind Avatar answered Oct 24 '22 00:10

CoolMind


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
like image 10
Fabiana Leguizamòn Ughelli Avatar answered Oct 23 '22 23:10

Fabiana Leguizamòn Ughelli