在使用多模块的时候,把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模块下就可以了
网友评论