手动下载Android Studio中gradle项目超时的依赖项文件

时间:2015-06-29 05:14:55

标签: android android-studio gradle aspectj robobinding

我正在尝试使用gradle将带有AspectJ的Robobinding添加到Android Studio中的新项目中。当我点击"与Gradle文件同步项目"时,该过程一直保持在" Gradle:下载https://jcenter.bintray.com/org/aspectj/aspectjtools/1.8.2/aspectjtools-1.8.2.jar"过夜8小时。它没有超时或抛出一些错误。

我尝试手动下载aspectjtools-1.8.2.jar并放置在C:\ Users \ Knobloch.gradle \ caches \ modules-2 \ files-2.1 \ org.aspectj \ aspectjtools \ 1.8.2中但是从附近的文件夹,他们有我需要的某种GUID子文件夹。

我尝试在libs文件夹中手动添加jar并使用:

compile files('libs/aspectjtools-1.8.2.jar')

哪个不起作用。 (现在我已经注意到我的模块配置中的gradle编译树功能将是多余的。)

以下是我的Project build.gradle的相关部分:

buildscript {
 repositories {
    jcenter()
    maven() {
        name 'RoboBinding AspectJPlugin Maven Repository'
        url "https://github.com/RoboBinding/RoboBinding-aspectj-plugin/raw/master/mavenRepo"
    }
 }
 dependencies {
    classpath 'org.robobinding:aspectj-plugin:0.8.4'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
 }
}
apply plugin: 'org.robobinding.android-aspectj'
apply plugin: 'com.neenbedankt.android-apt'

我的模块中的相关部分:app build.gradle:

dependencies {
 compile fileTree(include: ['*.jar'], dir: 'libs')
 compile 'com.android.support:appcompat-v7:22.2.0'
 compile 'com.android.support:support-v4:22.2.0'
 compile "org.robobinding:robobinding:$robobindingVersion"
 aspectPath "org.robobinding:robobinding:$robobindingVersion"
 //alternatively we can use with-aop-and-dependencies jar(RoboBinding provides a minimal Proguarded with-aop-and-dependencies jar.).
 compile("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
    exclude group: 'com.google.guava', module: 'guava'
 }
 aspectPath("org.robobinding:robobinding:$robobindingVersion:with-aop-and-dependencies") {
    exclude group: 'com.google.guava', module: 'guava'
 }
 compile files('libs/aspectjtools-1.8.2.jar')
}

1 个答案:

答案 0 :(得分:1)

请参阅@user“Andromeda”here给出的答案。

如果您使用的是Android Studio 0.8或更高版本,@ user“SamRad”会更详细地回答here