摇篮无法解析奥托库 [英] Gradle could not resolve otto library

查看:166
本文介绍了摇篮无法解析奥托库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试嵌入奥托库的它存在于Maven的中央

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.3'

    }
}

apply plugin: 'android'

dependencies {
    compile 'com.google.android.gms:play-services:4.0.30'
    compile 'com.android.support:support-v13:19.0.0'
    compile 'com.squareup:otto:1.3.4'
}

不过,我得到异常:

But I get the exception:

A problem occurred configuring root project 'sample-project'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':_DebugCompile'.
      > Could not find com.squareup:otto:otto:1.3.4.
        Required by:
            :sample-project:unspecified

我尝试刷新依赖( gradle这个--refresh依赖性),但它并不能帮助。

推荐答案

您需要告诉gradle这个哪里可以找到它。

You need to tell gradle where to find it.

repositories {
    mavenCentral()
}

请注意,现有的库{...} buildscript {...} 只配置为构建类路径本身的存储库,而不是你的项目,所以就把这个新元素只是在应用插件...

Note that the existing repositories { ... } inside buildscript { ... } is only to configure the repositories for the build classpath itself, not your project, so put this new element just under apply plugin ...

这篇关于摇篮无法解析奥托库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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