I'm trying from yesterday to configure gradle to build Android project. I've got same error since then:

Failed to notify project evaluation listener. Could not resolve all dependencies for configuration ':_DebugCompile'. Could not find any version that matches com.android.support:support-v4:13.0.+.

The official fix on many sites is to install Android Support Repository. I have it installed already, but problem still occurs. I've run out of ideas what can be wrong here...

Here is full code:

buildscript {
    repositories {
         mavenCentral()
     }

     dependencies {
         classpath 'com.android.tools.build:gradle:0.5+'
     }
}

apply plugin: 'android'

dependencies {
     compile 'com.android.support:support-v4:13.0.+'
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    sourceSets {
        main {
              manifest.srcFile 'AndroidManifest.xml'
              java.srcDirs = ['src']
              resources.srcDirs = ['src']
              aild.srcDirs = ['src']
              renderscript.srcDirs = ['src']
              res.srcDirs = ['res']
              assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('tests')
    }
}
有帮助吗?

解决方案 2

You need an additional block at the top level after your apply plugin line:

repositories {
     mavenCentral()
 }

In general, you need a repositories block at the same level as any dependencies block (hence why you also need one in the buildscript block).

Most of the time, you'd move your buildscript block to the top level build.gradle (so that all your modules use the same gradle build) rather than have them both at the module level.

其他提示

See http://tools.android.com/knownissues section Bundled Maven Repository

To fix this, open the SDK manager, and make sure that the "Android Support Repository" (not just Android Support Library) is installed:

com.android.support:support-v4:13.0.+ - this dependency isn't in Maven Central. Try to use https://github.com/mosabua/maven-android-sdk-deployer

I got the same error when trying to build the Android samples. My problem appeared because the ANDROID_HOME was not set correctly.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top