草庐IT

java - 找不到 com.android.support :support-v13:19. 0.0

coder 2023-12-04 原文

自上一轮更新以来,我一直收到此错误。 Gradle 绝对、断然拒绝找到 v13 支持库。我尝试了以下方法:

  • 安装最新的 Android 支持存储库以及最新的 Android 支持库
  • 前两条建议来自 here
  • 在构建脚本中指定最新的 gradle (0.12.+)
  • 指定不同版本的 v13 库

我可以在 m2repository 文件夹中看到它的 jars。事实上,我可以看到我尝试过的所有替代版本。

这是我的 build.gradle 的:

    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()
        }
    }

...然后在主项目中:

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

如有任何想法可以让 Gradle 查看 v13 库,我们将不胜感激。

最佳答案

解决了。

错误发生在 for 循环开始时的 copyDependencies 任务中。似乎 gradle 不会使用 sdk/extras/m2repository 来解决依赖关系。以下应该有效...

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

...但是没有。我认为 gradle 没有获取 ANDROID_HOME 存在问题。最后,我将整个 android/m2repository 复制到 .m2/repository 中,然后在父构建脚本中使用 mavenLocal() 而不是尝试访问 sdk 存储库。

另一种方法可能是将 exclude module: 'support-v13' 添加到 robolectric 依赖项排除中,但项目在其他地方需要它。

关于java - 找不到 com.android.support :support-v13:19. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24675607/

有关java - 找不到 com.android.support :support-v13:19. 0.0的更多相关文章

  1. java - 等价于 Java 中的 Ruby Hash - 2

    我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/

  2. java - 从 JRuby 调用 Java 类的问题 - 2

    我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www

  3. java - 我的模型类或其他类中应该有逻辑吗 - 2

    我只想对我一直在思考的这个问题有其他意见,例如我有classuser_controller和classuserclassUserattr_accessor:name,:usernameendclassUserController//dosomethingaboutanythingaboutusersend问题是我的User类中是否应该有逻辑user=User.newuser.do_something(user1)oritshouldbeuser_controller=UserController.newuser_controller.do_something(user1,user2)我

  4. java - 什么相当于 ruby​​ 的 rack 或 python 的 Java wsgi? - 2

    什么是ruby​​的rack或python的Java的wsgi?还有一个路由库。 最佳答案 来自Python标准PEP333:Bycontrast,althoughJavahasjustasmanywebapplicationframeworksavailable,Java's"servlet"APImakesitpossibleforapplicationswrittenwithanyJavawebapplicationframeworktoruninanywebserverthatsupportstheservletAPI.ht

  5. Observability:从零开始创建 Java 微服务并监控它 (二) - 2

    这篇文章是继上一篇文章“Observability:从零开始创建Java微服务并监控它(一)”的续篇。在上一篇文章中,我们讲述了如何创建一个Javaweb应用,并使用Filebeat来收集应用所生成的日志。在今天的文章中,我来详述如何收集应用的指标,使用APM来监控应用并监督web服务的在线情况。源码可以在地址 https://github.com/liu-xiao-guo/java_observability 进行下载。摄入指标指标被视为可以随时更改的时间点值。当前请求的数量可以改变任何毫秒。你可能有1000个请求的峰值,然后一切都回到一个请求。这也意味着这些指标可能不准确,你还想提取最小/

  6. 【Java 面试合集】HashMap中为什么引入红黑树,而不是AVL树呢 - 2

    HashMap中为什么引入红黑树,而不是AVL树呢1.概述开始学习这个知识点之前我们需要知道,在JDK1.8以及之前,针对HashMap有什么不同。JDK1.7的时候,HashMap的底层实现是数组+链表JDK1.8的时候,HashMap的底层实现是数组+链表+红黑树我们要思考一个问题,为什么要从链表转为红黑树呢。首先先让我们了解下链表有什么不好???2.链表上述的截图其实就是链表的结构,我们来看下链表的增删改查的时间复杂度增:因为链表不是线性结构,所以每次添加的时候,只需要移动一个节点,所以可以理解为复杂度是N(1)删:算法时间复杂度跟增保持一致查:既然是非线性结构,所以查询某一个节点的时候

  7. ruby - 安装libv8(3.11.8.13)出错,Bundler无法继续 - 2

    运行bundleinstall后出现此错误:Gem::Package::FormatError:nometadatafoundin/Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gemAnerroroccurredwhileinstallinglibv8(3.11.8.13),andBundlercannotcontinue.Makesurethat`geminstalllibv8-v'3.11.8.13'`succeedsbeforebundling.我试试gemin

  8. ruby-on-rails - rbenv:从 RVM 移动到 rbenv 后,在 Jenkins 执行 shell 中找不到命令 - 2

    我从Ubuntu服务器上的RVM转移到rbenv。当我使用RVM时,使用bundle没有问题。转移到rbenv后,我在Jenkins的执行shell中收到“找不到命令”错误。我内爆并删除了RVM,并从~/.bashrc'中删除了所有与RVM相关的行。使用后我仍然收到此错误:rvmimploderm~/.rvm-rfrm~/.rvmrcgeminstallbundlerecho'exportPATH="$HOME/.rbenv/bin:$PATH"'>>~/.bashrcecho'eval"$(rbenvinit-)"'>>~/.bashrc.~/.bashrcrbenvversions

  9. 【Java入门】使用Java实现文件夹的遍历 - 2

    遍历文件夹我们通常是使用递归进行操作,这种方式比较简单,也比较容易理解。本文为大家介绍另一种不使用递归的方式,由于没有使用递归,只用到了循环和集合,所以效率更高一些!一、使用递归遍历文件夹整体思路1、使用File封装初始目录,2、打印这个目录3、获取这个目录下所有的子文件和子目录的数组。4、遍历这个数组,取出每个File对象4-1、如果File是否是一个文件,打印4-2、否则就是一个目录,递归调用代码实现publicclassSearchFile{publicstaticvoidmain(String[]args){//初始目录Filedir=newFile("d:/Dev");Datebeg

  10. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

随机推荐