找不到com.android.support:design-23.2.1并且找不到com.android.support.appcompat-v7-23.2.1错误

时间:2016-04-30 18:03:37

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

我无法编译在另一台计算机上编写的android项目。

我得到的错误:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:appcompat-v7-23.2.1:.
     Searched in the following locations:
         file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.pom
         file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.jar
         https://jcenter.bintray.com/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.pom
         https://jcenter.bintray.com/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.jar
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.pom
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.jar
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.pom
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7-23.2.1//appcompat-v7-23.2.1-.jar
     Required by:
         CalorieCalculator:app:unspecified
   > Could not find com.android.support:design-23.2.1:.
     Searched in the following locations:
         file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/design-23.2.1//design-23.2.1-.pom
         file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/design-23.2.1//design-23.2.1-.jar
         https://jcenter.bintray.com/com/android/support/design-23.2.1//design-23.2.1-.pom
         https://jcenter.bintray.com/com/android/support/design-23.2.1//design-23.2.1-.jar
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/design-23.2.1//design-23.2.1-.pom
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/design-23.2.1//design-23.2.1-.jar
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/design-23.2.1//design-23.2.1-.pom
         file:/C:/Users/umr/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/design-23.2.1//design-23.2.1-.jar

这是build.gradle依赖项

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7-23.2.1'
    compile 'com.android.support:design-23.2.1'
}

sdkSettings

4 个答案:

答案 0 :(得分:2)

您的依赖项中存在一些拼写错误。

更改

  compile 'com.android.support:appcompat-v7-23.2.1'
  compile 'com.android.support:design-23.2.1'

  compile 'com.android.support:appcompat-v7:23.2.1'
  compile 'com.android.support:design:23.2.1'

答案 1 :(得分:1)

转到SDK Manager并转到SDK Tools选项卡。检查Android支持库版本并在build.gradle文件中对其进行编辑。如果出现“junit”错误,只需从依赖项中删除该junit行。

答案 2 :(得分:0)

如果您要在Android工作室上导入其他计算机项目,请确保该项目与您的sdk兼容,您缺少sdk支持存储库以与该项目兼容,

所以你有2种方法来运行这个项目。

1. update sdk or,
2. create new project and copy paste module of that project with your sdk configuration

答案 3 :(得分:0)

要从命令行解决它:

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

基本上为原始问题评论中提到的CommonsWare安装SDK Manager的" Android支持存储库"

android 是一个命令,它位于/Users/[username]/Library/Android/sdk/tools/用于macOS或[android sdk path]/android-sdk-linux/tools用于linux。