Search code examples
javaandroidandroid-libraryannotation-processing

NoClassDefFoundError: com/squareup/javapoet/TypeName when including library


I have been developing an annotation processor based library. When I run it as local library it works fine. for an example

implementation project(':dialogboot-annotations')
annotationProcessor project(':dialogboot-compiler')    

but after publishing it to jCenter. It looks something like

implementation 'com.masum.dialogboot:dialogboot-annotations:1.1.1'
annotationProcessor 'com.masum.dialogboot:dialogboot-compiler:1.1.1'

but when I use this jCenter repo, it generates this below error but locally it works fine

Error:Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider dialogboot.compiler.DialogProcessor could not be instantiated: java.lang.NoClassDefFoundError: com/squareup/javapoet/TypeName

Please help me out if anyone faced same problem after publishing the library in jCenter.


Solution

  • I resolved my problem by changing the android-maven-gradle-plugin version 2.0 instead of 1.1.4 in the root gradle dependencies

    classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'