找到你要的答案

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

Q:找不到COM。Android支持:support-v4:22.0.0。更新后的SDK

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

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'
}

但构建失败和显示

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

所以我增加了编译的COM。Android。支持:support-v4:22.0.0。'现在我得到

错误:无法找到:COM支持:support-v4:22.0.0。Android。
<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

在过去的几个小时里,我一直被困在里面,有谁能帮我找出这个问题

answer1: 回答1:

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

你的依赖build.gradle似乎是正确的。

尝试清理缓存(文件& gt;无效的缓存和重新启动),然后同步的文件和工具的清洁和建立。

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

你应该更新插件(1.1.0),摇篮版(2.2.1)和换线

minifyEnabled false
answer2: 回答2:

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'

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

错误:无法找到:COM支持:support-v4:22.0.0。Android。

如果你加上那个,那么我认为你的问题是额外的。最后.:)

尝试:

compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
answer3: 回答3:

As i know about this issue, It is because of version of supported library, what you need to do ,You using version that is not available with your current configuration.

  1. Just delete this line from the gradle file
  2. Now select your project goto module setting (Press F12)
  3. Add dependency again using library dependency.

Using above steps you are adding available version of support library.

我知道这个问题,这是因为支持库的版本,你需要做什么,你使用的版本是不可用的当前配置。

  1. Just delete this line from the gradle file
  2. Now select your project goto module setting (Press F12)
  3. Add dependency again using library dependency.

使用上述步骤,您将添加可用版本的支持库。

answer4: 回答4:

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

在我的情况下我只需要更新的SDK工具和演员。

answer5: 回答5:

If this might help someone, after MANY trials and errors, I found that I was targeting the wrong SDK version (an older one) in the build.gradle file corresponding to "library". To change this you can do it by hand or go to the Module Settings Menu (right click on your project folder -> Open Module Settings. Then in "library" - Properties you can change the Compile Sdk and the Build Tools Versions.

Obviously this worked for me after having all support libraries and building tools up to date.

如果这能帮助一个人,经过多年的试验和错误,我发现我的目标是错的SDK版本(老年人)在build.gradle文件对应的“图书馆”。要改变这个你可以用手做或去模块设置菜单(右键单击您的项目文件夹>;打开模块设置。然后,在“库”属性可以更改编译SDK构建工具版本。

显然,这对我来说,所有的支持库和建设工具至今。

answer6: 回答6:

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...

如何清除缓存工具?

这一切都在这里解释…

只是消灭你。Gradle全局缓存(缓存目录)!这是杀害我2天…

answer7: 回答7:

Change the gradle version like I have change 2.1 to 2.2.1 and it's working for me.

改变摇篮版像我有改变2.1 2.2.1和它的工作对我来说。

android  android-studio  android-gradle  android-support-library  build.gradle