Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find com.android.support:support-v4:22.0.0. after SDK update

After the sdk update im not able to create a hello world application. My build.gradle looks like this

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.coders.yo"
        minSdkVersion 11
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

But build got failed and shows

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:support-v4:22.0.0.
     Required by:
         Yo:app:unspecified > com.android.support:appcompat-v7:22.0.0

so i added compile 'com.android.support:support-v4:22.0.0.' and now i get

Error:Failed to find: com.android.support:support-v4:22.0.0.
<a href="openFile">Open File</a><br><a href="open.dependency.in.project.structure">Open in Project Structure dialog</a>

I have updated the android sdk enter image description here and the support libraries enter image description here

I have been stuck in it for the past few hours .Can some one please help me identify the issue

like image 238
playmaker420 Avatar asked Apr 02 '15 18:04

playmaker420


4 Answers

In my case I just needed to update SDK Tools and Extras.

like image 177
febaisi Avatar answered Oct 18 '22 00:10

febaisi


Your dependencies in build.gradle seem to be correct.

Try to clean the cache (File -> Invalidate cache and restart), then sync the gradle file and clean and build.

In your gradle file there is a strange line. This DSL doesn't exist in last gradle plugin (which version are you using?)

 runProguard false

You should update the plugin (1.1.0), the gradle version (2.2.1) and change this line in

minifyEnabled false
like image 12
Gabriele Mariotti Avatar answered Oct 17 '22 23:10

Gabriele Mariotti


so i added compile 'com.android.support:support-v4:22.0.0.' and now i get

Error:Failed to find: com.android.support:support-v4:22.0.0.

If you added exactly that, then I think your problem is the extra . at the end. :)

Try:

compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
like image 3
Jonik Avatar answered Oct 18 '22 00:10

Jonik


How to clear gradle cache?

This is all explained here...

Just wipe out your .gradle GLOBAL cache (caches directory)! This was killing me for 2 days...

like image 1
Cyphire Avatar answered Oct 18 '22 01:10

Cyphire