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

自古美人都是妖i 提交于 2021-02-18 19:55:09

问题


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

回答1:


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




回答2:


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



回答3:


Because jCenter will close in May, you should replace it with Maven. Thanks to @giorgos.nl now we can add Trove4j:20160824.

In root build.gradle write:

buildscript {
    repositories {
        google()
        maven {url 'https://plugins.gradle.org/m2/' }
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        // org.jetbrains.trove4j:trove4j:20160824.
        maven { url 'https://plugins.gradle.org/m2/' }
    }
}

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.




回答4:


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.



来源:https://stackoverflow.com/questions/49573157/android-studio-3-1-could-not-find-org-jetbrains-trove4jtrove4j20160824

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!