android studio项目中发生了Gradle任务错误

时间:2016-04-13 10:50:00

标签: android android-studio android-gradle build.gradle

我的项目已成功运行。但突然间,我在构建完成后收到以下错误。

谁能告诉我这里发生了什么?我不知道这个错误。我该如何解决?

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:cardview-v7:23.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         https://jcenter.bintray.com/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
     Required by:
         FinderMaterial:app:unspecified
   > Could not find com.android.support:support-v4:23.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
     Required by:
         FinderMaterial:app:unspecified > com.facebook.android:facebook-android-sdk:4.11.0
   > Could not find com.android.support:cardview-v7:23.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         https://jcenter.bintray.com/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.pom
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/cardview-v7/23.2.1/cardview-v7-23.2.1.jar
     Required by:
         FinderMaterial:app:unspecified > com.facebook.android:facebook-android-sdk:4.11.0
   > Could not find com.android.support:customtabs:23.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/customtabs/23.2.1/customtabs-23.2.1.pom
         https://jcenter.bintray.com/com/android/support/customtabs/23.2.1/customtabs-23.2.1.jar
         https://repo1.maven.org/maven2/com/android/support/customtabs/23.2.1/customtabs-23.2.1.pom
         https://repo1.maven.org/maven2/com/android/support/customtabs/23.2.1/customtabs-23.2.1.jar
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/customtabs/23.2.1/customtabs-23.2.1.pom
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/customtabs/23.2.1/customtabs-23.2.1.jar
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/customtabs/23.2.1/customtabs-23.2.1.pom
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/customtabs/23.2.1/customtabs-23.2.1.jar
     Required by:
         FinderMaterial:app:unspecified > com.facebook.android:facebook-android-sdk:4.11.0
   > Could not find com.android.support:support-v4:23.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
     Required by:
         FinderMaterial:app:unspecified > com.android.support:recyclerview-v7:23.2.0
         FinderMaterial:app:unspecified > com.android.support:design:23.2.0
         FinderMaterial:app:unspecified > com.android.support:appcompat-v7:23.2.0
         FinderMaterial:app:unspecified > com.android.support:appcompat-v7:23.2.0 > com.android.support:support-vector-drawable:23.2.0
   > Could not find com.android.support:support-v4:23.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
     Required by:
         FinderMaterial:app:unspecified > com.flipboard:bottomsheet-core:1.5.0
         FinderMaterial:app:unspecified > com.flipboard:bottomsheet-commons:1.5.0
         FinderMaterial:app:unspecified > com.github.citux:datetimepicker:0.2.0 > com.android.support:support-v13:23.1.1
   > Could not find com.android.support:support-v4:23.2.1.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         https://repo1.maven.org/maven2/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
         file:/opt/android-sdk-linux/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
     Required by:
         FinderMaterial:app:unspecified > com.google.android.gms:play-services:8.4.0 > com.google.android.gms:play-services-basement:8.4.0

提前致谢。

2 个答案:

答案 0 :(得分:14)

您应该将Android Repository do更新为:

  1. 打开SDK Manager
  2. Android支持存储库
  3. 安装包
  4. enter image description here

    在Android Studio 2.0中,您可以在以下位置找到:

    工具 - > Android -SDK Manager 菜单选项。

    对话框打开后,打开 Apearance and Behavior>系统设置> Android SDK ,然后选择第二个标签, SDK工具

答案 1 :(得分:1)

如果你想从命令行修复它(可能是像我的情况那样的自动构建服务器):

echo y | android update sdk --no-ui --filter extra-android-m2repository --force --all