2

I'm working on an app for myself to do the simple act of connecting to bluetooth devices! when I try to build the app to my Nexus 5 phone from Android Studio, it seems to not build the most recent changes I made. It somehow looks like it cached the first build. It fixes the issue when I go to File>Invalidate Cache. But then when I try to build it again, it seems to have caches the next build. Is there a way to prevent caching programatically? I had another app and it didn't happen to that one!

P.S. New to Android and Android Studio! :) Thanks

Vahid Zadeh
  • 564
  • 4
  • 25

2 Answers2

2

I made some changes and now it's working quite alright for me so thought I share it here to everyone else:

Go to Run->Edit Configurations->Android Application->Application->Miscellaneous Uncheck "Skip installtion if APK has not changed" and restart your Android Studio.

Now it should build your APK all the time you build to your phone!

If this did not do the trick for you, try doing the same process by going to: Go to Run->Edit Configurations->Android Application->Miscellaneous Go to Run->Edit Configurations->Android Native->Miscellaneous Go to Run->Edit Configurations->Android Tests->Miscellaneous

Then Sync your project with Gradle files and restart your Android Studio.

Vahid Zadeh
  • 564
  • 4
  • 25
1

You can go to

File -> Settings -> Build, Execution, Deployement -> Instant Run

and disable instant run.

By doing this Android Studio will build from scratch every time

You should also check the version of your Android plugin for Gradle.

Check this and this for more information.

Community
  • 1
  • 1
Charles Li
  • 1,835
  • 3
  • 24
  • 40