繁体   English   中英

Android 12 上的启动画面中的应用程序崩溃

[英]Application Crashing in Splash Screen on Android 12

我们的应用程序(在 Playstore 中下载超过 1 万次)有新的 Android 12 个用户面临自定义启动屏幕活动的崩溃,其中仅检查用户是否登录。此崩溃的唯一可能原因可能是新的启动屏幕api在Android 12中引入。但是即使集成后,这在android 12手机上也不起作用。 请帮助我在下面的代码中解决问题。

我正在使用图书馆:

实现 'androidx.core:core-splashscreen:1.0.0-alpha02'

在 splash.xml:

<resources>
    <style name="Theme.App.Starting" parent="Theme.SplashScreen">
        <item name="windowSplashScreenBackground">@drawable/appback</item>
        <item name="windowSplashScreenAnimatedIcon">@drawable/applogo</item>
        <item name="postSplashScreenTheme">@style/Theme.AppName</item>
    </style>

</resources>

在应用程序级别和活动级别声明主题,使用:

android:theme="@style/Theme.App.Starting"

在我的主屏幕(用户无法访问主屏幕没有登录),就在上面设置 contentView:

splashScreen.setKeepVisibleCondition((SplashScreen.KeepOnScreenCondition) () -> {
            if (user_id.equals("")){
                startActivity(new Intent(context,LoginActivity.class));
                finish();
            }
            return true;
        });

此属性必须是颜色,而不是可绘制对象(除非您的可绘制对象是颜色)

<item name="windowSplashScreenBackground">@drawable/appback</item>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM