android - Android 2即时运行

标签 android android-studio gradle

Per Android Studio instant run documentation

Code Change

  • Change implementation code of an existing instance method or static method

Instant Run Behavior

  • Supported with hot swap: This is the fastest type of swap and makes changes visible almost instantly. Your application keeps running and
    a stub method with the new implementation is used the next time the
    method is called.


但是,每当我对实例方法或静态方法进行更改时,总是会重启应用程序。有什么办法吗?

最佳答案

您确定看到的是应用程序重启而不是 Activity 重启吗?默认情况下,即使对于可热插拔的更改, Activity 重启也处于打开状态。您可以通过以下方法更改此行为:转到“设置”(或“首选项”)>“构建,执行,部署”>“即时运行”,然后取消选中“重新启动代码更改 Activity ”。

关于android - Android 2即时运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36633331/

相关文章:

环境占位符的 Gradle 属性

android - 从 Android Studio 中的 apk 中排除模块

android - 创建数据库 firebase

android - 是否可以从 TimePicker 中删除 AM/PM 按钮?

android - Detox 至少 75% 的 View 区域显示给用户

android - 无法在 gradle 文件中应用 'android-reporting'

android - 如何更改 CheckBox 正方形的颜色?

Android 在设备旋转时更改图像

android-studio - 更新到Android Studio 2.2后,带有Gradle的关于工件的警告

android - Android 是否支持 RTP/AVP/TCP?