android – How to use gradle BoM with annotation processor?-ThrowExceptions

Exception or error:

I’m trying to define all my dependencies in a bill of materials (BoM) platform module so the other modules in my multi-module project can use the same versions. All works fine except the kapt dependencies. In those I get this error:

Could not determine the dependencies of task ':app:kaptDebugKotlin'.
> Could not resolve all task dependencies for configuration ':app:kapt'.
   > Could not find
     Required by:
         project :app

For example with this platform (:bom) module:

plugins {
  id 'java-platform'
dependencies {
  constraints {
    api ''
    api ''

I’m getting that error when I use it like this in the app module:

dependencies {
  implementation platform(project(':bom'))
  implementation ''
  kapt ''
  // ...

I’m getting the same error if I use annotationProcessor. If I set the version like kapt '' all works.

What am I doing wrong? Can I use BoM for kapt or annotationProcessor?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *