So, I'm quite new to Android Studio but I have an issue: I program in Kotlin and when I change something in my code and press "Run" it just runs as it did before and ignoring the changes. If i press "Run" after that first try again it applies the changes. It also works, if I first hit "Buld/Clean Project".
What am I doing wrong? How can I make Android Studio to take the new code immediately?
Cheers.
Clean and then rebuild your project. Make your project (it should work by now) Check your dependencies in gradle. At the very end you can try invalidating the cache and restarting (Recommended)
Obviously, try to clean your project from android studio : “Build -> Clean Project”. This will clear your build folders. Clear the cache of Android Studio using “File -> Invalidate Caches / Restart” choose “Invalidate and restart option” and close Android Studio.
Instant Run is currently available only in Android Studio 2.0, and higher. We will continue to improve the feature in subsequent releases.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With