Recently i have upgraded Android Studio
from 1.5
to 2.0
.
With that i am using gradle 2.0.0
classpath 'com.android.tools.build:gradle:2.0.0'
But there seems some issue with it, whenever i am running my app for first time, it is showing while/black screen for 10-15 seconds.
There is nothing i am doing on applicationClass or launcher activity, but then also it is taking this much time.
I don't know whether it is issue with AS 2.0
or Gradle 2.0.0
. Strange thing is that it is working properly on emulator, it is just taking time on device. So there might be possibility of device RAM or processing issues, but i have checked it in 10-12 devices and all devices have same issue.
Problem arise when i am running my application for first time, then after it is working as usual and loads launcher activity within fraction of seconds.
Can anyone please help me in this?
In your build. gradle, if you have minifyEnabled for debug, remove it. I had it in my project and it took ~2-3 minutes to build.
One bit of a downside is that it takes roughly 3 minutes to re-sync when we "Import Gradle Project". There is no feedback to tell us what it is doing, so it's hard to know what we might tweak to see if we can get it faster. We are on the latest - 2019.2. x.
there seems some issue with it, whenever i am running my app for first time, it is showing while/black screen for 10-15 seconds.
I guess you have issue of Cold Start in your application.
Cold Start :
When a user launches an application, Android creates a new process that, during it charge, shows a black/white screen which is built with the application theme, or the theme of the activity that is the entry point.
This load can be increased if our application is complex and overwrites the application object, which is normally used to initialize the analytics, error reporters, etc.
Solution :
android:windowBackground
in your application theme. For detailed information please check, http://saulmm.github.io/avoding-android-cold-starts
Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With