net.bytebuddy.pool.TypePool$Resolution$NoSuchTypeException: Cannot resolve type description for androidx.room.RoomDatabase
We have an Android app written in Kotlin, and use androidx.room for local Database implementation.
Bytebudy version: 1.17.6 Room versions: 2.7.0, 2.7.2
When building the app, we get the following error:
Failed to transform class com.packagename.db.OurRoomDB: [net.bytebuddy.pool.TypePool$Resolution$NoSuchTypeException: Cannot resolve type description for androidx.room.RoomDatabase]
It is a standard Room Database implementation.
Attempted with Java compiler with versions 17 and 21.
This means that the plugin cannot find the androidx/room/RoomDatabase.class from the class loader / environment. Is this class file available?
ClassLoader result is in fact null, maybe the problem is with how RoomDatabase is compiled:
abstract class OurRoomDB : RoomDatabase() { ...
And the signature of RoomDatabase (from androidx.room package):
/**
* Base class for all Room databases. All classes that are annotated with [Database] must extend
* this class.
*
* RoomDatabase provides direct access to the underlying database implementation but you should
* prefer using [Dao] classes.
*
* @constructor You cannot create an instance of a database, instead, you should acquire it via
* [#Room.databaseBuilder] or [#Room.inMemoryDatabaseBuilder].
* @see Database
*/
actual abstract class RoomDatabase { ...
When going from RoomDatabase to its Source the actual class name is "RoomDatabase.android.kt"
But if the class file available?
classLoader.getResourceAsStream("androidx/room/RoomDatabase.class")
should return a value.