Android Studio:找不到com.android.support:support-v4:22.2.1

时间:2015-08-28 22:37:20

标签: android android-studio gradle

我的依赖项中有以下内容:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.github.satyan:sugar:1.3.1'
    compile 'com.android.support:support-v13:+'
}

并且项目编译得非常好,但是当我添加以下内容时:

compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'

我收到此错误消息:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:support-v4:22.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
         https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
     Required by:
         MyApp:app:unspecified > com.android.support:appcompat-v7:22.1.1
         MyApp:app:unspecified > com.android.support:support-v13:22.1.1
   > Could not find com.android.support:support-v4:22.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
         https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
         file:/C:/Users/Navarch/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
     Required by:
         MyApp:app:unspecified > com.mohamadamin:persianmaterialdatetimepicker:1.2.1

我搜索了很多,但似乎没有任何东西适用于我的情况。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

如果您有appcompat-v7:22.1.1,则表示您应该support-v4:22.1.1。您尝试使用的库正在请求support-v4:22.2.1,这是更新的。

确保您的Android Repository在SDK Manager中是最新的。通常,使用较旧的工件而不是较新的工件意味着您最近没有更新Android存储库。