Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

Android Studio 2.0 - pause/white screen on App first run

Since upgrading to Android Studio 2.0 (stable) I've noticed an issue that wasn't there in the previous version of Android Studio 1.5 I had installed.

I'm working on a current project, which I would build (debug version) and run, both on a real device, and an emulator, I was doing this in Android Studio 1.5.

Since upgrading Android Studio 2.0 whenever I make a build (debug) the same project/app and run it I have noticed that I get a pause on the device, or emulator. I get a white screen for a couple seconds before the app opens, which I didn't have before in AS 1.5, the app would open straight away, no pause, no white screen - this happens whether the phone is plugged in using ADB, or unplugged. If the App is still in phones memory it opens straight away, but if phone is restarted I get the pause, and white screen when the app is opened.

Is their a solution to this? Has anyone else experienced this? I may be a bit premature with this as I haven't done a release build yet, however this seems like a strange issue - if it is an issue!

Edit:

I am using Instant Run, however this happens whether a device is plugged in or not. Would Instant Run make a difference to its execution if it wasn't plugged in?

Update:

As below answer turning off 'Instant Run' options in Android Studio 2.0 cures the problem. Interestingly however, comments suggest that when using Instant Run APK sizes are smaller. What does this mean? Could it be that Instant Run uses the older Dalvik/JIT compiler rather than ART? This could explain the Apk size difference, and the lag (Dalvik compiles on the fly - JIT). Also ART would need to install/compile each time the app was Run, meaning its Apk size would be larger, and slower to execute, as is the case.

Hopefully someone with more experience and knowledge maybe able to confirm or debunk this..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Check image for reference Turn off Instant Run in Settings. File>Settings>Build,Deployment>Instant Run Deselect all options shown there.

Now white screen problem is solved.

In android studio 2.0,My APK size was 16 MB while using Instant Run. Without using Instant Run it became 27 MB. While in 1.5 .. the size was 27 MB.

Instant Run is the culprit.

  • White screen Issue/ Instant Run is only for Debug builds .. Issue will not affect release builds.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...