android - 找不到 android.support.design,...play-services,...support,...appcompat

标签 android android-studio build

我知道有很多类似的问题,但我确实尝试了那里描述的解决方案但没有成功。我已经重新安装并更新了 Android Studio,清理了项目,同步并使缓存失效并重新启动了它。我在构建项目(在其他 PC 上运行)时仍然出现此错误:

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
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.4.0.
 Searched in the following locations:
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0.pom
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0.jar
     https://jcenter.bintray.com/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0.pom
     https://jcenter.bintray.com/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0.jar
 Required by:
     MyApp:app:unspecified
   > Could not find com.android.support:design:23.4.0.
 Searched in the following locations:
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/design/23.4.0/design-23.4.0.pom
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/design/23.4.0/design-23.4.0.jar
     https://jcenter.bintray.com/com/android/support/design/23.4.0/design-23.4.0.pom
     https://jcenter.bintray.com/com/android/support/design/23.4.0/design-23.4.0.jar
 Required by:
     MyApp:app:unspecified
  > Could not find com.google.android.gms:play-services:9.0.1.
 Searched in the following locations:
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/android/gms/play-services/9.0.1/play-services-9.0.1.pom
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/android/gms/play-services/9.0.1/play-services-9.0.1.jar
     https://jcenter.bintray.com/com/google/android/gms/play-services/9.0.1/play-services-9.0.1.pom
     https://jcenter.bintray.com/com/google/android/gms/play-services/9.0.1/play-services-9.0.1.jar
 Required by:
     MyApp:app:unspecified
    > Could not find com.android.support:support-v4:23.4.0.
 Searched in the following locations:
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
     https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
     https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
 Required by:
     MyApp:app:unspecified

我的 Gradle 应用文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "myapp"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.google.android.gms:play-services:9.0.1'
    compile 'com.android.support:support-v4:23.4.0'
}

这非常令人沮丧,请告诉我该怎么做。

最佳答案

尝试运行它以在本地安装所需的库:

android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,android-23

关于android - 找不到 android.support.design,...play-services,...support,...appcompat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37876266/

相关文章:

android - 无法解析目标 'android-8'

ios - 使 Target 在 Xcode 中的构建产品路径依赖于当前方案

java - 如何生成JSON响应的POJO类

java - 您可以在位于 jar 中的构建文件上运行 Ant 吗?

apache-flex - 使用 ant,有谁知道如何构建由包含资源包的 SWC(您构建的)组成的 SWF?

Android BLE 启用通知

java - 如何添加具有点击状态的用户可配置按钮?

android - 特有的android RuntimeException

android - 导航 Activity 中 addBackStack 方法的嵌套 fragment 问题,无法完成后台 fragment 的工作,直接关闭应用程序问题

java - 如果处理器不支持虚拟化技术,则替代 Android 模拟器