我尝试嵌入奥托库,存在于Maven Central。
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'
}但我有个例外:
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-dependencies),但没有帮助。
发布于 2013-12-12 16:41:04
你得告诉格拉德尔在哪能找到它。
repositories {
mavenCentral()
}请注意,现有的repositories { ... }在buildscript { ... }中只用于配置构建类路径本身的存储库,而不是您的项目,因此将这个新元素放在apply plugin ...下面。
发布于 2013-12-12 09:55:26
我相信你缺少的是Tools->Android->Sync Project with Gradle Files。我在上面测试了你的代码,它对我来说很好。
希望这能有所帮助。
https://stackoverflow.com/questions/20539888
复制相似问题