2

Recently, I noticed running my App's debug variant of my first time - meaning installing it the first time, a white screen shows up before splash screen, which stays for quite long time ~ 15 sec on Nexus 6.

Also happens if I clear data, and run again.

At first I thought it was a side-effect of any patch, so I rolled back to the working published revision.

But the same thing occurred. Although if I install from Play, it works normally.

So, I ran a 'release' build, and voila! It was working normally. It's obviously not caused by the Application class, or any other code change, as that would happen for the release also.

It's also obviously not the same as brief white screen problem mentioned elsewhere, like this (thread): So when I applied the transparent theme to splash as suggested there, after tapping on the App, the phone screen froze, no touch worked for the same amount of time, then Splash showed.

Not getting any clue why changing to debug will cause such a huge problem. And why first run only.

Community
  • 1
  • 1
Abu Ruqaiyah
  • 1,516
  • 1
  • 12
  • 20
  • Maybe this would help a bit [thread](http://stackoverflow.com/questions/36575229/android-studio-2-0-pause-white-screen-on-app-first-run?answertab=votes#tab-top) by turning off the `instant run` – Pritish Vaidya Dec 27 '16 at 06:17
  • check this link https://www.youtube.com/watch?v=Vw1G1s73DsY&index=74&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE – amorenew Dec 28 '16 at 08:46
  • you can handle it by settings a custom theme. Do not set splash directly – Saveen Dec 30 '16 at 17:37
  • still having this problem with android studio 4.1.2. instant run does not exist anymore. any suggestions? – Tommehh Aug 04 '21 at 08:02

5 Answers5

4

It is because you're using Android studio instant run.

You can disable it like this:

Properties -> Instant Run -> uncheck 'Enable Instant Run...'

Duda
  • 1,673
  • 17
  • 22
  • nope this is wrong, I am using Android studio 2.2.3 , first i also thought it is because of instant run, but it is not. sorry brother. – AJay Dec 29 '16 at 05:46
  • @AJay disabling instant run resolved it for me, so I accepted it. – Abu Ruqaiyah Dec 30 '16 at 06:09
0

As per my experience when you working with app pls ignore this thing but when you provide a build to client/tester please make sign build and check same in your device this problem resolve. Still, i'm found the perfect solution with debugging till you may use this. ( this is only happening API 24 and later).

Arpan24x7
  • 648
  • 5
  • 24
0

make a drawable like this one with name background_splash

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

    <item
        android:drawable="@color/gray"/>

    <item>
        <bitmap
            android:gravity="center"
            android:src="@mipmap/ic_launcher"/>
    </item>

</layer-list>

then in styles add the style like this:

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

then in your activity in manifest add your style

<activity
    android:name=".SplashActivity"
    android:theme="@style/SplashTheme">

more information: Splash Screens the Right Way

also you can check android performance patterns episods: android performance patterns

amorenew
  • 10,760
  • 10
  • 47
  • 69
0

If You have put android:debuggable="false"" in Manifest file Change it to

android:debuggable="true"

or Properties -> Instant Run -> uncheck 'Enable Instant Run...'

wscourge
  • 10,657
  • 14
  • 59
  • 80
Rahul Karande
  • 259
  • 2
  • 9
0

Properties -> Instant Run -> uncheck 'Enable Instant Run...'

MurugananthamS
  • 2,395
  • 4
  • 20
  • 49