Failed to resolve: com.android.support:appcompat-v

2020-07-17 05:18发布

I just installed Android Studio on elementary os 0.3.1 (based on Ubuntu 14.04 LTS), but I get the following error:

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

When I click on "Install Repository and sync project", I get this error:

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.

My build.gradle (Module: 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.+'
}

My build.gradle (Project: 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
}

3条回答
太酷不给撩
2楼-- · 2020-07-17 05:50

try to install the option Android Support Library on the menu tools >> Android >> SDK Manager >> SDK Tools (tab).

Before that create a new project, that's worked for me.

查看更多
叼着烟拽天下
3楼-- · 2020-07-17 06:01

Got same errors.

Mac OSX

V. 10.9.5

Android studio 1.4.1

build.gradle:

Before:
android { compileSdkVersion 15 buildToolsVersion "19.1.0"

After:
android { compileSdkVersion 23 buildToolsVersion "19.1.0"

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

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


AndroidStudioProjects > 'app_name' > app > build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.johnkonderla.condor_paint"
    minSdkVersion 16
    targetSdkVersion 23
    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:23.1.0'
compile 'com.android.support:design:23.1.0'
}

Above changes + Build >> Clean Project.

Hope that helps!

查看更多
Animai°情兽
4楼-- · 2020-07-17 06:02

From Android Studio go to: Tools >> Android >> SDK Manager Select and install "Extras|Android Support Repository"

If doesnt help, please post your gradle file.

查看更多
登录 后发表回答