【发布时间】:2021-08-27 12:03:21
【问题描述】:
我正在使用依赖项“androidx.core:core-splashscreen:1.0.0-alpha01”作为我的启动画面。在 IDE 和项目中使用 Android Gradle Plugin 7.0.1(带有 Android Studio Arctic Fox 2020.3.1 Patch 1)、Kotlin 1.5.20 和 Java 11 设置。
我使用自己的 SplashActivity 来根据情况将用户路由到不同的活动(进行反根检查、身份验证检查等)。
我的 onCreate() 有以下内容:
val splashScreen = installSplashScreen()
splashScreen.setOnExitAnimationListener { routeToOtherActivity() }
而且我从不调用 setContentView()。
其他一切都根据迁移指南进行设置:
https://developer.android.com/about/versions/12/splash-screen-migration
问题是,当我在调试模式下通过 Android Studio 运行我的应用程序时,Theme.App.Starting 主题中设置的 windowSplashScreenAnimatedIcon drawable 永远不会显示,并且永远不会调用 setOnExitAnimationListener。所以我的应用程序停留在 SplashActivity 中,并且永远不会发生路由。当我使用应用程序启动器手动再次运行我的应用程序时,它按预期运行,并且绘图可见并且路由成功,因为侦听器按预期工作。
有什么解决办法吗?是否有任何未解决的问题? (没找到)
我在物理设备 Google Pixel 4 XL 上运行该应用。
【问题讨论】:
标签: android debugging migration splash-screen