Android Studio 2.0 - 应用程序首次运行时暂停/白屏 [英] Android Studio 2.0 - pause/white screen on App first run

查看:89
本文介绍了Android Studio 2.0 - 应用程序首次运行时暂停/白屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从升级到 Android Studio 2.0(稳定版)后,我发现了一个在我安装的以前版本的 Android Studio 1.5 中不存在的问题.

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.

我正在处理一个当前项目,我将在真实设备和模拟器上构建(调试版本)并运行该项目,我在 Android Studio 1.5 中执行此操作.

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.

自从每次我构建(调试)同一个项目/应用程序并运行它时升级 Android Studio 2.0 以来,我注意到我在设备或模拟器上暂停.我在应用程序打开前出现了几秒钟的白屏,这是我在 AS 1.5 中没有的,应用程序会立即打开,没有暂停,没有白屏 - 无论手机是否使用 ADB 插入,都会发生这种情况,或拔掉.如果应用程序仍在手机内存中,它会立即打开,但如果手机重新启动,我会在应用程序打开时出现暂停和白屏.

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!

我使用的是 Instant Run,但是无论是否插入设备都会发生这种情况.如果没有插入 Instant Run,它的执行会有所不同吗?

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?

更新:

如下回答关闭 Android Studio 2.0 中的即时运行"选项可以解决问题.然而有趣的是,评论表明使用 Instant Run APK 时尺寸更小.这是什么意思?难道 Instant Run 使用的是旧的 Dalvik/JIT 编译器而不是 ART?这可以解释 Apk 大小差异和滞后(Dalvik 即时编译 - JIT).此外,每次运行应用程序时,ART 都需要安装/编译,这意味着它的 Apk 大小会更大,执行起来也更慢,就像这种情况.

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..

推荐答案

检查图片以供参考在设置中关闭即时运行.文件>设置>构建、部署>即时运行取消选择此处显示的所有选项.

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

现在白屏问题解决了.

在 android studio 2.0 中,使用 Instant Run 时我的 APK 大小为 16 MB.如果不使用 Instant Run,它变成了 27 MB.而在 1.5 .. 大小为 27 MB.

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 是罪魁祸首.

Instant Run is the culprit.

  • 白屏问题/即时运行仅适用于调试版本.问题不会影响发布版本.

这篇关于Android Studio 2.0 - 应用程序首次运行时暂停/白屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆