我想在使用Android Studio和Gradle的Android项目中使用Roboguice。我一直在关注their installation guide,但是我对Gradle和Android Studio还是陌生的,我不确定这些部分如何组合在一起。
本质上,我已经更改了应用程序的build.gradle
文件,其中包括以下内容:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'org.roboguice:roboguice:3.+'
provided 'org.roboguice:roboblender:3.+'
}
在Android Studio中同步更改后,我希望访问
RoboActivity
等,但是找不到引用。谁能解释这是怎么回事?
谢谢,
马特
最佳答案
我决定阅读有关Gradle及其工作原理的更多信息。最终,我发现了很多对mavenCentral()
和jcenter()
存储库的引用。
mavenCentral和jcenter都是基于Java的软件包存储库(有点像.NET的Nuget)。
我猜想Roboguice在jcenter中不可用,因为如果您使用mavenCentral,一切似乎都可以使用。为了更改您的存储库,您可以更改项目级别的gradle.build
文件。
// Top-level build file where you can add configuration options common
// to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
}
}
关于android - 在Android Studio中安装Roboguice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28219031/