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?
-
Are you using assets of high resolution – Android Geek Feb 14 '18 at 04:42
-
Yes because of the cold start of the application , are you using some heavy images in launcher activity ? – Abdul Kawee Feb 14 '18 at 04:44
-
Possible duplicate of [How To fix white screen on app Start up?](https://stackoverflow.com/questions/20546703/how-to-fix-white-screen-on-app-start-up) – Vidhi Dave Feb 14 '18 at 04:51
3 Answers
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)

- 2,161
- 3
- 22
- 42
It could be the problem because of Instant Run, disable Instant Run.
Setting-> Build, Execution, Deployment-> Instant Run-> Uncheck Instant Run

- 2,531
- 5
- 22
- 33
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">

- 6,621
- 1
- 24
- 27