Could not find com.android.support:support-v13:19.0.0

Since the last round of updates, I get this error. Gradle absolutely categorically refuses to find the v13 support library. I tried the following:

  • Install the latest Android support repository, as well as the latest Android support library.
  • first two sentences here
  • indicating the last Gradle (0.12. +) in the build script
  • specifying different versions of the v13 library

I see banks in the m2repository folder for her. In fact, I see all the alternate versions I tried.

Here is my build.gradle's:

buildscript { repositories { def androidHome = System.getenv("ANDROID_HOME") mavenCentral() maven { url "$androidHome/extras/android/m2repository/" } } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.9.4' } ext.compileSdkVersion = 19 ext.buildToolsVersion = "19.0.3" ext.minSdkVersion = 14 ext.targetSdkVersion = 18 ext.buildVersion = 8 ext.codeVersion = 5 } allprojects { repositories { mavenCentral() } } 

... and then in the main project:

  apply plugin: 'android' apply plugin: 'android-test' tasks.withType(Compile) { options.encoding = 'UTF-8' } def getVersionCode = { -> return getDate() } def getDate() { def date = new Date() return date.getTime().toInteger() + 1000000000 } def getVersionName = { -> try { def stdout = new ByteArrayOutputStream() exec { commandLine 'git', 'describe', '--tags', '--dirty' standardOutput = stdout } return stdout.toString().trim() } catch (ignored) { return null; } } dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'com.android.support:support-v13:19.0.0' compile 'com.android.support:support-v4:19.1.0' compile 'com.fasterxml.jackson.core:jackson-databind:2.3.0' compile project(':lib-volley') compile project(':lib-pulltorefresh') compile project(':lib-player') androidTestCompile 'org.hamcrest:hamcrest-all:1.3' androidTestCompile 'org.mockito:mockito-core:1.9.5' androidTestCompile 'junit:junit:4.11' androidTestCompile('org.robolectric:robolectric:2.3:jar-with-dependencies') { exclude module: 'classworlds' exclude module: 'maven-artifact' exclude module: 'maven-artifact-manager' exclude module: 'maven-error-diagnostics' exclude module: 'maven-model' exclude module: 'maven-plugin-registry' exclude module: 'maven-profile' exclude module: 'maven-project' exclude module: 'maven-settings' exclude module: 'nekohtml' exclude module: 'plexus-container-default' exclude module: 'plexus-interpolation' exclude module: 'plexus-utils' exclude module: 'wagon-file' exclude module: 'wagon-http-lightweight' exclude module: 'wagon-http-shared' exclude module: 'wagon-provider-api' } androidTestCompile 'com.squareup:fest-android:1.0.7' testCompile 'org.hamcrest:hamcrest-all:1.3' testCompile 'org.mockito:mockito-core:1.9.5' testCompile 'junit:junit:4.11' testCompile('org.robolectric:robolectric:2.3:jar-with-dependencies') { exclude module: 'classworlds' exclude module: 'maven-artifact' exclude module: 'maven-artifact-manager' exclude module: 'maven-error-diagnostics' exclude module: 'maven-model' exclude module: 'maven-plugin-registry' exclude module: 'maven-profile' exclude module: 'maven-project' exclude module: 'maven-settings' exclude module: 'nekohtml' exclude module: 'plexus-container-default' exclude module: 'plexus-interpolation' exclude module: 'plexus-utils' exclude module: 'wagon-file' exclude module: 'wagon-http-lightweight' exclude module: 'wagon-http-shared' exclude module: 'wagon-provider-api' } testCompile 'com.squareup:fest-android:1.0.7' } android { compileSdkVersion rootProject.compileSdkVersion buildToolsVersion rootProject.buildToolsVersion defaultConfig { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion versionCode getVersionCode() versionName getVersionName() } ... # signingConfigs and productFlavors removed buildTypes { debug { packageNameSuffix ".debug" versionNameSuffix " debug" debuggable true jniDebugBuild true } trial { packageNameSuffix ".trial" versionNameSuffix " trial" signingConfig signingConfigs.debug debuggable true jniDebugBuild true } release { runProguard false proguardFile 'proguard-android.txt' proguardFile getDefaultProguardFile('proguard-android.txt') debuggable false jniDebugBuild false signingConfig signingConfigs.release zipAlign true } } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' res.srcDirs = ['res'] } trial { assets.srcDirs = ['assets'] } release { assets.srcDirs = ['assets-release'] } debug { assets.srcDirs = ['assets'] } androidTest.setRoot('src/test') } packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/DEPENDENCIES' } lintOptions { disable 'ValidFragment' } } if (project.hasProperty('keyAlias')) { android.signingConfigs.release.keyAlias = keyAlias } androidTest { include '**/*Test.class' } apply plugin: 'idea' idea { module { testOutputDir = file(rootProject.testOutputDir) } } task copyDependencies(type: Copy) { description = 'Copy dependencies to a libraries folder. Useful for Eclipse' ext.libDir = new File(project.projectDir, '/libraries') println libDir ext.srclibDir = new File(project.projectDir, '/libs') println srclibDir println 'Adding dependencies from lib directory' copy { from srclibDir into libDir } println 'Adding dependencies from compile configuration' for (file in configurations.compile) { copy { from file into libDir } } println 'Adding dependencies from releaseCompile configuration' for (file in configurations.releaseCompile) { copy { from file into libDir } } println 'Adding dependencies from debugCompile configuration' for (file in configurations.debugCompile) { copy { from file into libDir } } println 'Adding dependencies from androidTestCompile configuration' for (file in configurations.androidTestCompile) { copy { from file into libDir } } } 

Any ideas on how to get Gradle to see the v13 library would be greatly appreciated.

+6
source share
1 answer

I decided.

An error occurred inside the copyDependencies task at the beginning of for loops. It seems that gradle will not use sdk / extras / m2repository to resolve dependencies. The following should have worked ...

 repositories { def androidHome = System.getenv("ANDROID_HOME") mavenCentral() maven { url "$androidHome/extras/android/m2repository/" } } 

... but did not. I think there is a problem with gradle not collecting ANDROID_HOME. In the end, I copied the entire android / m2repository file to .m2 / repository, and then used mavenLocal() in the parent build of the script instead of trying to access the sdk repository.

Another approach would be to add an exclude module: 'support-v13' to the robolectric dependency exceptions, but the project needed it elsewhere.

+2
source

Source: https://habr.com/ru/post/972022/


All Articles