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

编译及Gradle构建成功后运行App报错:Writing not allowed due to timeout or cancellation

解决「Error running 'app' Writing not allowed due to timeout or cancellation」问题

以下是针对该问题的可行解决方案,按优先级尝试:

  • 检查设备存储空间:这个报错大概率和目标设备剩余存储不足有关,即便其他设备正常,当前测试设备可能缓存或垃圾文件占满了空间。清理设备缓存、卸载无用应用或删除大文件后再重试。
  • 重启ADB与设备:
    • 打开终端执行 adb kill-server,接着运行 adb start-server 重启ADB服务
    • 完全重启测试设备,重新连接后再部署App
  • 调大部署超时时间:
    • 打开Android Studio的「File > Settings」(Mac是「Android Studio > Settings」)
    • 导航到「Build, Execution, Deployment > Deployment」
    • 将「Deployment timeout (seconds)」的数值从默认30调整为60或更高,保存后重新运行
  • 关闭即时运行功能:
    • 进入「Settings > Build, Execution, Deployment > Instant Run」
    • 取消勾选「Enable Instant Run to hot swap code/resource changes on deploy」,重启Android Studio后重试
  • 清理项目缓存并重构:
    • 在项目根目录终端执行 ./gradlew clean(Windows系统用 gradlew clean)
    • 点击Android Studio顶部菜单栏的「Build > Rebuild Project」,完成后重新部署
  • 排查USB连接问题:
    • 更换USB端口或换一根质量可靠的USB线,避免因连接不稳定导致部署中断
    • 确认设备已开启「USB调试」,且连接模式设置为「文件传输(MTP)」

内容的提问来源于stack exchange,提问作者Abdul Lateef Sherani

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 07:10:55