MutableLiveData with Kotlin multiple layler Generic not work

282 views Asked by At

Android MutableLiveData with Kotlin multiple layler Generic not work

//ErrorInfo data class
data class ErrorInfo<T>(
        var common: StatusCode?,
        var individual: T?,
        var message: String?
)

//use
val error: MutableLiveData<ErrorInfo<LoginRepo.LoginError>>

so many type error output.

エラー: がありません - not found indextifier

エラー: 無効なメソッド宣言です。戻り値の型が必要です。 - invalid method, need return type

エラー: ';'がありません - not found ;

エラー: シンボルを見つけられません- cannot found symbol

エラー: 型引数の数が不正です。1個必要です - wrong paramater count. need one.

sorry above japanese error message.

and

java.lang.IllegalStateException: failed to analyze: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing

1

There are 1 answers

0
changhao cui On

Resolve by myself: Because Kotlin cannot use const with package name. After moving Kotlin data class to result folder, this build success!!!