0

I have developed an app. The apk file size is less than 10 MB. However, whenever the app makes it's first run in any device, it goes blank for the first 15 seconds (white screen) and then it works perfectly fine. The Android Monitor during those 15 seconds displays: "Real Application Class is null". Can someone help me with this?

Rahul Singh Chandrabhan
  • 2,531
  • 5
  • 22
  • 33

3 Answers3

2

Why white screen shows up-

The white screen is called preview screen which android displays based on your theme until drawables and other resources are ready to be loaded in your activity.

How to get ride-

Declare a theme like

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_screen</item>
</style>

Here, @drawable/splash_screen is any (jpg) image or anything

Add this theme in manifest Splash Activity-

<activity
        android:name=".SplashActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/SplashTheme"
        android:windowSoftInputMode="stateAlwaysHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    </activity>

I guess you can also use (I have not tested it) background color instead of white screen by putting below line inside style tag-

 <item name="android:windowBackground">"Color code to replace white"</item>

Result - By this that drawable will be shown until Splash Screen (Activity) is fully ready (loaded)

Exigente05
  • 2,161
  • 3
  • 22
  • 42
0

It could be the problem because of Instant Run, disable Instant Run.

Setting-> Build, Execution, Deployment-> Instant Run-> Uncheck Instant Run

Rahul Singh Chandrabhan
  • 2,531
  • 5
  • 22
  • 33
0

According to the details provided, it might be issues on memory adding “android:largeHeap="true”” to manifest may help.
 If not please provide some log or code or IDE version you are using as it might be problematic of Instant Run.

Manifest file:

<application
    android:name="com.project.App"
    android:allowBackup="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:largeHeap="true"
    android:theme="@style/AppTheme"
    tools:overrideLibrary="android.support.v4"
    tools:replace="android:allowBackup">
Patrick R
  • 6,621
  • 1
  • 24
  • 27