android - 在Android Studio中安装Roboguice

标签 android gradle android-studio android-gradle-plugin roboguice

我想在使用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/

相关文章:

android - 将相同的图库图像加载到两个不同的 Activity fragment 中 Android Picasso

android - 使用Android项目的Gradle插件将代码注入(inject)合并 list

android - 如何在谷歌地图中获取当前位置

intellij-idea - 将另一个 gradle 项目导入现有的 android 项目时,Android Studio 访问被拒绝

java - 无法发送包含尖锐字符的按键字符串

android - Android Firebase在ListView中检索数据错误

android: onClickListener for relativelayout

java - 在gradle中创建一个shadow jar?

android - 找不到OpenCv Manager套件

android - IDE 无法创建目录。可能原因 : parent directory is read-only or the user lacks necessary permissions