Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:26.1.0). Searched in the fol

1320 ワード

今日奇妙な問題に遭遇しました.新しいプロジェクトをインポートしたとき、android studioコンパイルが間違っていました.
Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:26.1.0).
Searched in the following locations:
    https://jcenter.bintray.com/com/android/support/recyclerview-v7/26.1.0/recyclerview-v7-26.1.0.jar

Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

前後何度もチェックしましたが、プロジェクトではrecyclerviewを使用する場所がなく、依存参照による可能性があります.プロジェクトルートディレクトリのbuildファイルをチェックすると、次のように書かれています.
allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven {
            url "https://jitpack.io"
        }
    }
}

emm...何の問題もないようです.clean、Rebuild、buildファイルを削除してclean、gradleバージョンを交換してstudioバージョンを交換して、すべて同じエラーを提示します.突然私が気づいたのは、「https://jcenter.bintray.com/...」アドレスはrecyclerviewをダウンロードできませんが、実際にはGoogleのリポジトリで対応ファイルを探すべきです.jcenter()とmavenを順番に変えて、ルートディレクトリの下のbuildファイルを次のように変更してみます.
allprojects {
    repositories {
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
    }
}

コンパイル合格!いろいろな方法を変えてやっと解決したが,本当に忙しい任務なら本当に人を急尿させることができる.