Error al hacer que Enum sea la key principal en la biblioteca de la database de la sala

Estoy usando una enumeración para ser una key principal para la biblioteca de database Room con TypeConvertor y no comstack en time de ejecución y arroja un error

Aquí está mi convertidor

class QuranIndexConverter { @TypeConverter fun toQuranIndex(index: String): QuranIndex { return QuranIndex.valueOf(index) } @TypeConverter fun toStringIndex(quranIndex: QuranIndex): String { return quranIndex.name }} 

Aquí el Dao

  @Dao interface SuraDao { @Query("SELECT * FROM " + Constants.TABLE_NAME) fun getAll(): LiveData<List<Sura>> @Insert fun insertAll(suras: List<Sura>) @Insert fun insert(sura: Sura) @Delete fun deleteAll(suras: List<Sura>) @Delete fun delete(sura: Sura)} 

Aquí está el module

 @Entity(tableName = Constants.TABLE_NAME) data class Sura( @PrimaryKey val quranIndex: QuranIndex = QuranIndex.ABS, @ColumnInfo(name = "sura_name") val suraName: String = "Abasa", @ColumnInfo(name = "download_url") val downloadUrl: String = "www.google.com") 

Aquí está la database de la habitación

 @Database( entities = arrayOf(Sura::class), version = 1) @TypeConverters(QuranIndexConverter::class) abstract class Appdatabase : RoomDatabase() { abstract fun suraDao(): SuraDao } 

El post de error

  e: H:\Work\Android\Inmaa\Nour\NourPLayerArch\app\build\tmp\kapt3\stubs\debug\com\abdelmeged\ahmed\nourplayerarch\db\entity\Sura.java:31: error: Room cannot pick a constructor since multiple constructors are suitable. Try to annotate e: e: public Sura(@org.jetbrains.annotations.NotNull() e: ^ e: unwanted constructors with @Ignore. e: H:\Work\Android\Inmaa\Nour\NourPLayerArch\app\build\tmp\kapt3\stubs\debug\com\abdelmeged\ahmed\nourplayerarch\db\entity\Sura.java:38: error: Room cannot pick a constructor since multiple constructors are suitable. Try to annotate e: e: public Sura() { e: ^ e: unwanted constructors with @Ignore. e: H:\Work\Android\Inmaa\Nour\NourPLayerArch\app\build\tmp\kapt3\stubs\debug\com\abdelmeged\ahmed\nourplayerarch\db\entity\Sura.java:8: error: Cannot find setter for field. e: e: private final com.abdelmeged.ahmed.nourplayerarch.utils.QuranIndex quranIndex = null; e: ^ e: H:\Work\Android\Inmaa\Nour\NourPLayerArch\app\build\tmp\kapt3\stubs\debug\com\abdelmeged\ahmed\nourplayerarch\db\entity\Sura.java:11: error: Cannot find setter for field. e: e: private final java.lang.String suraName = null; e: ^ e: H:\Work\Android\Inmaa\Nour\NourPLayerArch\app\build\tmp\kapt3\stubs\debug\com\abdelmeged\ahmed\nourplayerarch\db\entity\Sura.java:14: error: Cannot find setter for field. e: e: private final java.lang.String downloadUrl = null; e: ^ w: H:\Work\Android\Inmaa\Nour\NourPLayerArch\app\build\tmp\kapt3\stubs\debug\com\abdelmeged\ahmed\nourplayerarch\db\Appdatabase.java:6: warning: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false. w: w: public abstract class Appdatabase extends android.arch.persistence.room.RoomDatabase { w: ^ e: java.lang.IllegalStateException: failed to analyze: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:144) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:167) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:55) at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:182) at org.jetbrains.kotlin.daemon.CompileServiceImpl.execCompiler(CompileServiceImpl.kt:397) at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execCompiler(CompileServiceImpl.kt:99) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$2.invoke(CompileServiceImpl.kt:365) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$2.invoke(CompileServiceImpl.kt:99) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2$$special$$inlined$withValidClientOrSessionProxy$lambda$1.invoke(CompileServiceImpl.kt:798) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2$$special$$inlined$withValidClientOrSessionProxy$lambda$1.invoke(CompileServiceImpl.kt:99) at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137) at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:825) at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$checkedCompile(CompileServiceImpl.kt:99) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2.invoke(CompileServiceImpl.kt:797) at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2.invoke(CompileServiceImpl.kt:99) at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive(CompileServiceImpl.kt:1004) at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive$default(CompileServiceImpl.kt:865) at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:791) at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$doCompile(CompileServiceImpl.kt:99) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1.invoke(CompileServiceImpl.kt:364) at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1.invoke(CompileServiceImpl.kt:99) at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive(CompileServiceImpl.kt:1004) at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive$default(CompileServiceImpl.kt:865) at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:336) at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:90) at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:42) at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:205) at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:166) at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:82) at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:89) at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:99) at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:76) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.analyze(KotlinToJVMBytecodeCompiler.kt:365) at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:105) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:354) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:139) ... 39 more 

Tengo este error, porque kotlin aparentemente genera múltiples constructores de java para un único constructor de kotlin con valores de argumento pnetworkingeterminados. Código de trabajo edito la class de datos para que sea así:

 @Entity(tableName = Constants.TABLE_NAME) data class Sura( @PrimaryKey val quranIndex: QuranIndex, @ColumnInfo(name = "sura_name") val suraName: String , @ColumnInfo(name = "download_url") val downloadUrl: String ) 
  • Kotlin Closable y SQLiteDatabase en Android
  • ¿Cómo puedo unirme a tres entidades en GreenDao?
  • Escriba desajuste. Mapa obligatorio <String, Any> Found Map <String, Any?>
  • Seleccionar datos de dos tablas en Kotlin Anko
  • Base de datos de android de Kotlin: no se puede convertir java.lang.String en android.database.Cursor