I am writing an Android library that I plan to use with different projects. There is also an annotation processor library that I am writing that would be used to generate code based on annotation defined in the previous library.
The project structure is:
Project
-> app (the test app)
-> Android Library
-> Annotation Processor
My android library depends on appcompat and support:design libraries. Build.gradle for it is:
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')
}
And build.gradle for annotation processor is:
apply plugin: 'java'
sourceSets {
main {
java {
srcDirs = ['src/main/java']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(":lib")
}
The issue here is when I build the project it gives me following error:
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
It compiles if dependency of android library is removed from annotation processor module. That means android library project is able to access support and design packages but not annotation processor.