Android 致命异常主错误空指针异常

Android 致命异常主错误空指针异常,android,kotlin,fatal-error,Android,Kotlin,Fatal Error,我在运行应用程序时出错,因为主应用程序不是我的转换器。我不知道该怎么做才能把它修好,有人能帮我吗 日志错误: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.pokedex, PID: 22909 java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.c

我在运行应用程序时出错,因为主应用程序不是我的转换器。我不知道该怎么做才能把它修好,有人能帮我吗

日志错误:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.pokedex, PID: 22909
java.lang.NullPointerException: Parameter specified as non-null is null: method 
 kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter value
    at com.example.pokedex.Converters.fromAbilityPokemonList(Unknown Source:2)
    at com.example.pokedex.dao.PokemonDAO_Impl$1.bind(PokemonDAO_Impl.java:62)
    at com.example.pokedex.dao.PokemonDAO_Impl$1.bind(PokemonDAO_Impl.java:36)
    at androidx.room.EntityInsertionAdapter.insert(EntityInsertionAdapter.java:63)
    at com.example.pokedex.dao.PokemonDAO_Impl$2.call(PokemonDAO_Impl.java:84)
    at com.example.pokedex.dao.PokemonDAO_Impl$2.call(PokemonDAO_Impl.java:79)
    at androidx.room.CoroutinesRoom$Companion$execute$2.invokeSuspend(CoroutinesRoom.kt:54)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at androidx.room.TransactionExecutor$1.run(TransactionExecutor.java:45)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:923)
类转换器

class Converters {
// Conversor PokemonAbility
@TypeConverter
fun fromAbilityPokemonList(value: List<PokemonAbility>): String {
    val gson = Gson()
    val type = object : TypeToken<List<PokemonAbility>>() {}.type
    return gson.toJson(value, type)
}

@TypeConverter
fun toAbilityPokemonList(value: String): List<PokemonAbility> {
    val gson = Gson()
    val type = object : TypeToken<List<PokemonAbility>>() {}.type
    return gson.fromJson(value, type)
}

// Conversor Type Pokemon
@TypeConverter
fun fromTypePokemonList(value: List<String>): String {
    val gson = Gson()
    val type = object : TypeToken<List<String>>() {}.type
    return gson.toJson(value, type)
}

    @TypeConverter
    fun toTypePokemonList(value: String): List<String> {
    val gson = Gson()
    val type = object : TypeToken<List<String>>() {}.type
    return gson.fromJson(value, type)
}
类转换器{
//Conversor口袋妖怪
@类型转换器
fun fromAbilityPokemonList(值:List):字符串{
val gson=gson()
val type=object:TypeToken(){}.type
返回gson.toJson(值,类型)
}
@类型转换器
有趣的ToAbilitypokeOnlist(值:字符串):列表{
val gson=gson()
val type=object:TypeToken(){}.type
返回gson.fromJson(值,类型)
}
//Conversor型口袋妖怪
@类型转换器
趣味fromTypePokemonList(值:List):字符串{
val gson=gson()
val type=object:TypeToken(){}.type
返回gson.toJson(值,类型)
}
@类型转换器
趣味toTypePokemonList(值:String):列表{
val gson=gson()
val type=object:TypeToken(){}.type
返回gson.fromJson(值,类型)
}

在我进行迁移以将“Not Null”更改为文本我的数据库数据后,此错误开始出现。您正在接收fromAbilityPokemonList中的值:List Null。是否改为使用List

@TypeConverter
fun fromAbilityPokemonList(value: List<PokemonAbility>?): String {
    val gson = Gson()
    val type = object : TypeToken<List<PokemonAbility>>() {}.type
    return gson.toJson(value ?: ArrayList<PokemonAbility>(), type)
}
@TypeConverter
乐趣来自能力项目列表(值:列表?):字符串{
val gson=gson()
val type=object:TypeToken(){}.type
返回gson.toJson(值?:ArrayList(),类型)
}