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/