Gradle不在线搜索依赖项

时间:2015-10-18 21:51:37

标签: android android-studio gradle android-gradle

我是Gradle的新手,并在工作中从存储库下载了一个项目。

当我打开项目时,Gradle无法同步。

Error:Could not find org.robobinding:codegen:0.8.9.
Searched in the following locations:
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/android/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.pom
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/android/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.jar
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/google/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.pom
file:/C:/Users/Marcelo/AppData/Local/Android/sdk/extras/google/m2repository/org/robobinding/codegen/0.8.9/codegen-0.8.9.jarRequired by:
GollogAndroidApp:gollog:unspecified

根据此日志错误,我猜Gradle并未在线搜索Robobinding。我查看了Android Studion的Gradle离线配置工作,但未进行检查。

这是我的gradle.build

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.android.tools.build:gradle:1.1.1'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.6'
  }
}

apply plugin: 'com.android.application'
apply plugin: 'org.robobinding.android-aspectj'
apply plugin: 'com.neenbedankt.android-apt'

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.1"

  lintOptions{
    ignoreWarnings true
  }

  defaultConfig {
    applicationId "br.com.fake.fakeproject"
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
  }
  buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        debuggable true
    }
  }

  productFlavors {
    dev {
        applicationId "br.com.edeploy.fake.fakeproject"
    }
     prod {
        applicationId "br.com.edeploy.fake.fakeproject"
    }
  }

  packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
 }
}

ext {
  //robobindingVersion = 'latest.integration'
  daggerVersion = '1.2.2'
  robobindingVersion = '0.8.9'
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:23.0.1'
  compile 'info.hoang8f:android-segmented:1.0.6'
  compile 'com.android.support:support-v4:23.0.1'
  compile 'net.danlew:android.joda:2.8.2'
  compile 'de.greenrobot:eventbus:2.4.0'
  compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
  compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'

  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'
  }

  apt "org.robobinding:codegen:$robobindingVersion"
  compile 'com.google.auto.value:auto-value:1.1'

  apt "com.squareup.dagger:dagger-compiler:$daggerVersion"
  compile "com.squareup.dagger:dagger:$daggerVersion"
  /*provided "org.glassfish:javax.annotation:10.0-b28"*/

  testCompile "junit:junit:4.12"
  testCompile "org.mockito:mockito-all:1.10.19"
}

我已更新Android和Google存储库。

我正在使用Android Studio 1.4

韩国社交协会!

1 个答案:

答案 0 :(得分:2)

您仅为您的buildscript定义了存储库 - 而不是为项目定义 - 添加:

repositories {
    jcenter()
}

在root级别后面:apply plugin:'com.neenbedankt.android-apt'