【发布时间】:2017-03-21 01:49:11
【问题描述】:
我的库中有以下代码:
@Documented
@IntDef({OpacityAnimationType.NONE,
OpacityAnimationType.BLINKING,
OpacityAnimationType.SHINY,
OpacityAnimationType.AURA,
})
public @interface OpacityAnimationType {
int NONE = 0;
int BLINKING = 1;
int SHINY = 2;
int AURA = 3;
}
在我有图书馆的 gradle 中
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["library" : "true"]
}
}
}
}
和
configurations {
javadocDeps
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:support-annotations:$supportLibraryVersion"
javadocDeps "com.android.support:support-annotations:$supportLibraryVersion"
}
我将其部署到 JFrog BinTray,然后尝试在我的应用程序中使用它。我必须从库依赖项中排除 appcompat-v7 和 support-annotations,但我构建仍然失败:
错误:无法解决:annotationProcessor
现在我被卡住了,尝试了很多东西,但没有任何帮助。我无法用这个库构建主项目。 我是否需要实现任何自定义 AnnotationProcessor 才能使用 @IntDef's?
【问题讨论】:
-
也尝试从库中删除,但没有帮助 javadocDeps "com.android.support:support-annotations:$supportLibraryVersion" 试图从主项目的库依赖中删除 @aar,但它也没有帮助。
标签: android gradle annotations aar annotation-processor