美文网首页
Hilt模块化报错ClassCastException

Hilt模块化报错ClassCastException

作者: 克罗克达尔 | 来源:发表于2021-01-13 14:12 被阅读0次

    在使用多模块的时候,把Application放在公共模块里面,运行的时候报错

    Caused by: java.lang.ClassCastException: com.ke.wanandroid.common.DaggerMainApplication_HiltComponents_SingletonC$ActivityRetainedCImpl$ActivityCImpl cannot be cast to com.ke.wanandroid.ui.splash.SplashActivity_GeneratedInjector
            at com.ke.wanandroid.ui.splash.Hilt_SplashActivity.inject(Hilt_SplashActivity.java:62)
            at com.ke.wanandroid.ui.splash.Hilt_SplashActivity.onCreate(Hilt_SplashActivity.java:36)
            at com.ke.wanandroid.ui.splash.SplashActivity.onCreate(SplashActivity.kt:18)
            at android.app.Activity.performCreate(Activity.java:8086)
            at android.app.Activity.performCreate(Activity.java:8074)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1313)
    

    Application放到app模块下就可以了

    相关文章

      网友评论

          本文标题:Hilt模块化报错ClassCastException

          本文链接:https://www.haomeiwen.com/subject/msvuaktx.html