You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio 无法自动保存修改,热重启加载旧代码问题如何解决

问题原因
  1. 「Instant Run」功能已在Android Studio Arctic Fox及更高版本中被官方完全移除,替换为「Apply Changes」功能,因此旧教程里的关闭路径不存在,对应的旧解决方案不适用当前版本。
  2. 长时间未启动IDE导致本地配置缓存异常,自动保存规则被意外关闭,构建时只会读取上一次手动保存的代码文件。
  3. Flutter插件与IDE版本适配异常,无法触发修改后的自动增量编译逻辑,导致热重启始终复用旧的构建产物。
修复步骤
  • 开启IDE自动保存配置
    打开路径 File > Settings > Appearance & Behavior > System Settings(Mac系统路径为 Android Studio > Preferences > Appearance & Behavior > System Settings),在Synchronization分类下勾选两个选项:
    • Save files if the IDE is idle for [自定义时长,建议设为5-10秒]
    • Save files when switching to a different application
  • 调整Apply Changes配置
    打开路径 File > Settings > Build, Execution, Deployment > Apply Changes,取消勾选 Rerun app if changes can't be applied,同时勾选 Recompile classes when code changes are detected
  • 清理IDE全局缓存
    点击顶部菜单栏 File > Invalidate Caches...,勾选「Clear file system cache and local history」后点击「Invalidate and Restart」,等待IDE自动重启
  • 适配Flutter开发配置
    打开路径 File > Settings > Languages & Frameworks > Flutter,勾选 Hot reload on save,保证文件保存后自动触发增量编译逻辑

配置完成后修改代码,等待对应自动保存间隔后触发热重启即可加载最新代码,无需每次执行flutter clean或删除build目录。

内容的提问来源于stack exchange,提问作者Meggy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 12:21:03