我创建了一个使用JavaPoet生成类的Android库。它在我的本地工作区上运行良好;即使我将库模块包含到另一个项目中。
现在我正试图通过绑定盘将我的项目放到网上。该项目被正确上传,但当我将其包含到一个新项目并构建projet时,我会得到以下消息:
错误:错误的服务配置文件,或在构造处理器对象时引发的异常: javax.annotation.processing.Processor: Provider me.aflak.filter_processor.FilterProcessor无法实例化: java.lang.NoClassDefFoundError: com/squareup/javapoet/TypeName
我想它来自我管理依赖关系的方式..。编译时间运行时的东西..。
这里是processor build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':filter-annotation')
api 'com.squareup:javapoet:1.9.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.google.auto.service:auto-service:1.0-rc3'
}这是注释 buid.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.8.1'
}下面是我如何将库包含在一个空项目中:
// build.gradle project
repositories {
maven{
url 'https://dl.bintray.com/omaflak/maven'
}
}
// build.gradle module
dependencies {
compile 'me.aflak.libraries:filter-annotation:1.0'
annotationProcessor 'me.aflak.libraries:filter-processor:1.0'
}有人能给我指出正确的方向吗?谢谢!
发布于 2017-09-13 16:29:50
我终于得到了解决方案(有点随意,不过是:p)。
我不得不在库模块中添加mavenLocal()。
https://stackoverflow.com/questions/46123090
复制相似问题