androidandroid-studioandroid-instant-runinstant-run

How to disable Instant Run rebuild for a specific module?


I am using Card.io as a module within my app. I have some slight modifications, that is why I have it as a module. The problem is that having this module dependency causes Instant Run to make Cold Swap every time the project changes. The moment I comment the card.io library, Hot Swap is OK.

I get this message "Static Initializer Change" whenever Instant Run makes Cold Swap. And the Card.io library is full of static initializers. How can I tell instant run to not rebuild this module no matter what happens?


Solution

  • Basically, what I did was to remove every single dependency in the project and look if Instant Run was making Hot Swaps or Cold Swaps. I detected that the card.io library was breaking the Hot Swapping, so I took the production version of the library from the build/outputs folder and imported it as aar into the project.