应用程序启动画面仅显示在安装/运行Android Studio上

时间:2017-11-08 16:51:49

标签: android android-studio splash-screen

我使用本教程实现了一个启动画面:https://www.bignerdranch.com/blog/splash-screens-the-right-way/

如果我通过Android Studio安装/运行应用程序,我可以在应用程序启动时看到启动画面。现在,我通过Android Studio关闭应用程序或关闭所有应用程序"从我的手机,我想直接通过手机中的图标启动应用程序。但是我看不到闪屏。在我实现启动画面之前只有白屏。如果我在MainActivity中进行了更改 - 这些更改都在手机上。

有人知道出了什么问题吗?

2 个答案:

答案 0 :(得分:1)

确保使用Launcher的此意图过滤器仅位于清单中的SplashActivity中。

<intent-filter>
    <action android:name="android.intent.action.MAIN" />

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

否则提供您的清单和SplashActivity代码。

答案 1 :(得分:0)

这是因为您正在运行调试版本。尝试在您的设备中运行realese build。 在发布版本中启用收缩资源,缩小并应用proguard

以下示例

minifyEnabled true
       shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
                'proguard-rules.txt'

        zipAlignEnabled true