android - 无法解析 : com. android.support :appcompat-v7. 15

标签 android ubuntu

我刚刚在 elementary os 0.3.1(基于 Ubuntu 14.04 LTS)上安装了 Android Studio,但出现以下错误:

Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:15.+ 
Install Repository and sync project
Show in File
Show in Project Structure dialog

当我点击“Install Repository and sync project”时,出现这个错误:

Loading SDK information...
Ignoring unknown package filter 'extra-android-m2repository' 
Warning:The package filter removed all packages. There is nothing to install.
     Please consider trying to update again without a package filter.

我的build.gradle(模块:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 15
    buildToolsVersion "19.1.0"

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

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

我的build.gradle(项目:HappyBirthday)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

最佳答案

从 Android Studio 转到:工具 >> Android >> SDK 管理器 选择并安装“Extras|Android Support Repository”

如果没有帮助,请发布您的 gradle 文件。

关于android - 无法解析 : com. android.support :appcompat-v7. 15,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32914794/

相关文章:

android - 获取通过以太网连接的 Android DhcpInfo

java - Android 在启动时动态设置菜单项

php - 为什么在 ubuntu 20 上安装 php7.4 我在控制台中有 php 8?

php - 在 php 7 (ubuntu14.04) 中安装 cURL

android - 线性布局中的 ImageView 权重

android - 如何切换 TextViews 的位置?

java - 无法访问\\$wsl WSL - Intellij IDEA 无法访问 JDK

docker - 无法在 docker 中使用 alpine os 配置带有 echo 的代码,但可以在 ubuntu 中

java - 为什么 Java 的 .addShutdownHook 在 BeagleBone Black 上不能用于 Ctrl-C?有解决方法吗?

android - 在 Android Studio 2.0 中,在 Debug模式下找不到方法的局部变量