android - 我必须在 Android Studio 上的“运行”之前按两次“运行”或清理项目
问题描述
所以,我对 Android Studio 很陌生,但我有一个问题:我在 Kotlin 中编程,当我更改代码中的某些内容并按“运行”时,它会像以前一样运行并忽略更改。如果我在第一次重试后按“运行”,它会应用更改。如果我第一次点击“Buld/Clean Project”,它也可以工作。
我究竟做错了什么?如何让 Android Studio 立即获取新代码?
干杯。
解决方案
Update
it seems to be that the issue is fixed in newer android studio version, currently i am working on android studio 4.2.1 and it is working fine even with allowing the parallel run feature.
Old Answer
After a long search, I found that the issue is in something called instant run when you rerun your code, to solve this issue in the older android studio you have to disable instant run by going to:
File -> Settings -> Build,Execution,Deployment -> Instant Run
and then disable it.
For me I am using the android studio +4.0.0 version so I opened:
Run -> Edit configurations... -> disable check box (Allow parallel run)*
It may slow your build a little but it better than running the app more than one time.
推荐阅读
- android - 如何在 React-Native 中提取 Android 上的 cookie?
- cucumber - 使用jenkins在jira中上传黄瓜场景大纲的结果
- unit-testing - 对 influxdb 查询进行单元测试的最简单方法应该是什么
- python - 如何根据所有列的条件从熊猫数据框中排除行
- android - 需要 Android SDK 和 Android 应用程序的单一 Firebase 分析
- mysql - 我一直在寻找解决方案来获取 Mysql 中多列(单行)的总和,以获得每小时的电费发票总数?
- angular - 全局关闭材料 matInput 的自动完成功能
- python - for..in. 的循环空行有问题。如何在没有错误的情况下完成它?
- jquery - 如何使 Jquery ui 日期选择器范围
- javascript - 使用 useState() 挂钩时如何更新 const 变量“count”