Android注释处理器gradle错误

时间:2015-07-14 00:47:51

标签: android annotations android-gradle annotation-processing

我正在编写一个我计划用于不同项目的Android库。我正在编写一个注释处理器库,用于根据前一个库中定义的注释生成代码。

项目结构是:

Project
    -> app (the test app)
    -> Android Library
    -> Annotation Processor

我的android库依赖于appcompat和支持:设计库。 Build.gradle是:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0 rc2"

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:design:22.2.0'
    compile files('libs/guava-18.0.jar')
}

注释处理器的build.gradle是:

apply plugin: 'java'

sourceSets {
    main {
        java {
            srcDirs = ['src/main/java']
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(":lib")
}

这里的问题是当我构建项目时,它会给我以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':threepio-anno-proc:compile'.
        > Could not find com.android.support:appcompat-v7:22.2.0.
        Searched in the following locations:
        https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
Required by:
Threepio:threepio-anno-proc:unspecified > Threepio:lib:unspecified
> Could not find com.android.support:design:22.2.0.
        Searched in the following locations:
        https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.pom
https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.jar
Required by:
Threepio:threepio-anno-proc:unspecified > Threepio:lib:unspecified

如果从注释处理器模块中删除了android库的依赖项,则编译它。这意味着android库项目能够访问支持和设计包,但不能访问注释处理器。

0 个答案:

没有答案