gpt4 book ai didi

android - Google Play 控制台中的 Dagger Hilt 崩溃

转载 作者:行者123 更新时间:2023-12-04 23:49:08 25 4
gpt4 key购买 nike

我在我的项目中使用 Hilt 库(版本 2.36)并且在我的 Google Play 控制台中出现以下崩溃,崩溃发生在所有 android 版本和所有设备上,我猜主要是在 Android 9 中。

java.lang.IllegalStateException
dagger.hilt.android.internal.managers.ActivityComponentManager.createComponent
完整的堆栈跟踪:
java.lang.RuntimeException: 
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3430)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3614)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:86)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2199)
at android.os.Handler.dispatchMessage (Handler.java:112)
at android.os.Looper.loop (Looper.java:216)
at android.app.ActivityThread.main (ActivityThread.java:7625)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)
Caused by: java.lang.IllegalStateException:
at dagger.hilt.android.internal.managers.ActivityComponentManager.createComponent (ActivityComponentManager.java:76)
at dagger.hilt.android.internal.managers.ActivityComponentManager.generatedComponent (ActivityComponentManager.java:66)
at com.kingim.activities.Hilt_MainActivity.generatedComponent (Hilt_MainActivity.java:40)
at com.kingim.activities.Hilt_MainActivity.inject (Hilt_MainActivity.java:62)
at com.kingim.activities.Hilt_MainActivity$1.onContextAvailable (Hilt_MainActivity.java:33)
at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable (ContextAwareHelper.java:99)
at androidx.activity.ComponentActivity.onCreate (ComponentActivity.java:322)
at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java:273)
at com.kingim.activities.BaseActivity.onCreate (BaseActivity.kt:77)
at android.app.Activity.performCreate (Activity.java:7458)
at android.app.Activity.performCreate (Activity.java:7448)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1286)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3409)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3614)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:86)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2199)
at android.os.Handler.dispatchMessage (Handler.java:112)
at android.os.Looper.loop (Looper.java:216)
at android.app.ActivityThread.main (ActivityThread.java:7625)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)
BaseActivity 和 MainActivity(扩展 BaseActivity)显示在我的要点中:
https://gist.github.com/eldartsa/ba3e0f47e279d21242aa09b1c51e863f

最佳答案

所以this article应该解释一下。但是,本质上是 Application类将始终在 Activity 之前创建, Service , BroadcastReceiver所以您可以放心调用getApplication() . ContentProvider虽然可以在 Application 之前实例化.很有可能您遇到了 backupMode 的问题。检查您的 list 是否有 android:allowBackup="true" .

关于android - Google Play 控制台中的 Dagger Hilt 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68662816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com