使用 gradle (Android Studio) 和本地 maven repo 时无法构建应用程序 [英] Cannot build app when using gradle (Android Studio) and local maven repo

查看:36
本文介绍了使用 gradle (Android Studio) 和本地 maven repo 时无法构建应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试包含库 Slik卡片-UI 在我的应用程序中,我使用 android studio 和 gradle 来构建.没有这个,应用程序构建得很好,但添加依赖项会使构建失败.查看构建的调试日志,它似乎没有在本地存储库中查找 arr 文件.我可以看到文件在那里,我已经按照 github wiki 页面上的教程进行安装,并且工作正常.错误是:

配置项目:climbtrack"时出现问题.>无法解析配置 ':climbtrack:_debugCompile' 的所有依赖项.>找不到 com.afollestad.cardsui:library:1.0-SNAPSHOT.要求:ClimbTrack:climbtrack:未指定>找不到 com.afollestad.silk:library:1.0-SNAPSHOT.要求:ClimbTrack:climbtrack:未指定

这是我的 build.gradle

buildscript {存储库{MavenCentral()}依赖{类路径 'com.android.tools.build:gradle:0.7.+'}}应用插件:'android'存储库{行家本地()MavenCentral()}安卓 {compileSdkVersion 18构建工具版本19.0.0"默认配置{minSdk 版本 15目标SDK版本19版本代码 1版本名称1.0"}构建类型{释放 {runProguard 假proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'}}}依赖{编译 'com.google.android.gms:play-services:4.0.30'编译'com.afollestad.cardsui:library:1.0-SNAPSHOT'编译'com.afollestad.silk:library:1.0-SNAPSHOT'}

google play 服务依赖项工作正常,并且按预期从 maven 中央存储库中找到.任何人的想法?谢谢

解决方案

This is bug https://code.google.com/p/android/issues/detail?id=63908

如果您查看该错误中的注释 #3,则有一个解决方法.试试看是否有帮助:

<块引用>

这似乎是具有本地 Maven 存储库的 Gradle 1.9 中的一个错误.

请参阅 https://plus.google.com/109385828142935151413/posts59/h>aZ7rX7

目前的解决方法是使用

 maven { url "${System.env.HOME}/.m2/repository" }

<块引用>

代替 mavenLocal()

I am trying to include the library Slik and Cards-UI in my app, I'm using android studio and gradle to build. The app builds fine without this but adding the dependency make the build fail. Looking at the debug log of the build it doesn't seem to be looking in the local repo for the arr file. I can see the files are there and I have followed the tutorial on the github wiki page for the install and that works fine. The error is:

A problem occurred configuring project ':climbtrack'.
> Could not resolve all dependencies for configuration ':climbtrack:_debugCompile'.
   > Could not find com.afollestad.cardsui:library:1.0-SNAPSHOT.
     Required by:
         ClimbTrack:climbtrack:unspecified
   > Could not find com.afollestad.silk:library:1.0-SNAPSHOT.
     Required by:
         ClimbTrack:climbtrack:unspecified

Here is my build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}
apply plugin: 'android'

repositories {
    mavenLocal()
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services:4.0.30'
    compile 'com.afollestad.cardsui:library:1.0-SNAPSHOT'
    compile 'com.afollestad.silk:library:1.0-SNAPSHOT'
}

The google play services dependency works fine and is found from the maven central repo as expected. Any ideas anyone? Thanks

解决方案

This is bug https://code.google.com/p/android/issues/detail?id=63908

If you look at comment #3 in that bug, there's a workaround. Try it and see if it helps:

This appears to be a bug in Gradle 1.9 with local Maven repositories.

See https://plus.google.com/109385828142935151413/posts/hF7W59uZ7rX

The workaround for now is to use

 maven {   url "${System.env.HOME}/.m2/repository" } 

instead of mavenLocal()

这篇关于使用 gradle (Android Studio) 和本地 maven repo 时无法构建应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆