Android 12+ 的 Google Play Console 预发布报告中出现重复的启动画面问题

问题描述 投票:0回答:2

大家早上好

我在 Google Play 控制台中遇到了一个莫名其妙的稳定性问题,该问题在每次发布前报告后都会出现警告,并附有以下注释:

重复的启动画面 在 Android 12 或更高版本上启动应用程序时,会显示两个启动画面。更新您的应用程序以使用 SplashScreen API 来解决问题。

提供的详细信息是: “爬虫程序在您的应用程序中检测到一个空的或自定义的启动画面,该启动画面在 Android 12 或更高版本上启动应用程序时显示在系统启动画面之后。显示了两个启动画面。

更新您的应用程序以使用 SplashScreen API 来解决问题。”

这里的问题是我什至没有闪屏;我只有一项活动,文档也不一定有帮助:

https://developer.android.com/develop/ui/views/launch/splash-screen

我已经找了快一周了,还没有找到任何解决方案。有人可以帮助我吗?或者我可以忽略此消息吗?

我将 android:launchMode="singleTask" 添加到清单中,

添加了以下内容,即使我没有启动屏幕:实现'androidx.core:core-splashscreen:1.0.1',

并在themes.xml中添加以下内容: 正确

我在这里找到了以下内容,但它不适用于我的应用程序: Play 控制台启动前警告“双闪屏”

一切都没有成功。

android google-play-console
2个回答
0
投票

这就是我的清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">


    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
 

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher_round"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Ticolly"
        tools:targetApi="31">
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="######" />

        <meta-data
            android:name="firebase_crashlytics_collection_enabled"
            android:value="${crashlyticsCollectionEnabled}" />
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

这是我的主题

<style name="Base.Theme.Ticolly" parent="Theme.Material3.DayNight.NoActionBar">

    <item name="android:windowBackground">@color/background</item>
    <item name="android:statusBarColor">@color/background</item>
    <item name="android:navigationBarColor">@color/background</item>
    <item name="android:windowLightStatusBar">false</item>
    <item name="android:windowIsTranslucent">true</item>

    <item name="colorPrimary">@color/accent</item>
    <item name="colorSecondary">@color/accent</item>
    <item name="colorPrimaryInverse">@color/accent</item>

    <item name="colorOnPrimary">@color/background</item>
    <item name="colorPrimaryContainer">@color/background</item>
    <item name="colorSurfaceVariant">@color/background</item>
    <item name="colorSecondaryContainer">@color/accentLight</item>

    <item name="chipStyle">@style/CustomChip</item>
</style>

<style name="CustomChip" parent="Widget.MaterialComponents.Chip.Choice">
    <item name="chipSurfaceColor">@color/chip_background</item>
    <item name="android:textColor">@color/chip_textcolor</item>
    <item name="chipStrokeColor">@color/iconContrastLight</item>
    <item name="chipStrokeWidth">1dp</item>
</style>

0
投票

这是我的主要活动的缩短版本,那里没有进行其他函数调用:

protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        setContentView(R.layout.activity_main);
        if (Build.VERSION.SDK_INT < 27) {
            int color = ContextCompat.getColor(this, R.color.viewPagerOverlay);
            getWindow().setNavigationBarColor(color);
        }
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));


        recyclerView = findViewById(R.id.recyclerView);
        empty_view = findViewById(R.id.empty_view);
        placeHolder = findViewById(R.id.placeHolder);
        cardView = findViewById(R.id.cardView);
        replyContainer = findViewById(R.id.replyContainer);
        snackHolder = findViewById(R.id.snack_holder);
        snackContainer = snackHolder.findViewById(R.id.snack_container);





        FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
        FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
                .setMinimumFetchIntervalInSeconds(3600)
                .build();

        mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);

        mFirebaseRemoteConfig.activate();
        mFirebaseRemoteConfig.fetchAndActivate()
                .addOnCompleteListener(this, task -> {
                
                        /** other stuff **/
                });


        // Create a ConsentRequestParameters object.
        ConsentRequestParameters params = new ConsentRequestParameters
                .Builder()
                .build();

        consentInformation = UserMessagingPlatform.getConsentInformation(this);
        consentInformation.requestConsentInfoUpdate(
                this,
                params,
                () -> UserMessagingPlatform.loadAndShowConsentFormIfRequired(
                        this,
                        loadAndShowError -> {
                            if (loadAndShowError != null) {
                                // Consent gathering failed.
                                Logger.error(String.format("%s: %s",
                                        loadAndShowError.getErrorCode(),
                                        loadAndShowError.getMessage()));
                            }

                            // Consent has been gathered.
                            if (consentInformation.canRequestAds()) {
                                initializeMobileAdsSdk();
                            }
                        }
                ),
                requestConsentError -> {
                    // Consent gathering failed.
                    Logger.error(String.format("%s: %s",
                            requestConsentError.getErrorCode(),
                            requestConsentError.getMessage()));
                });

       
        if (consentInformation.canRequestAds()) {
            initializeMobileAdsSdk();
        }



    getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) {

            /** other stuff **/
        });



        View rootView = findViewById(android.R.id.content);



        rootView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {

            Rect r = new Rect();
            rootView.getWindowVisibleDisplayFrame(r);
            int screenHeight = rootView.getRootView().getHeight();

            int keypadHeight = screenHeight - r.bottom;

            if (keypadHeight > screenHeight * 0.15)  {

                placeHolder.animate().alpha(0).setDuration(0).start();
                placeHolder.setVisibility(View.GONE);

            } else {
                placeHolder.setVisibility(View.VISIBLE);
                placeHolder.animate().alpha(1.0f).setDuration(400).start();

            }
        });
    }
© www.soinside.com 2019 - 2024. All rights reserved.