13

I've updated to Android Studio 3.0 and now I cannot run the app with Instant Run enabled.

I get 'Execution failed for task' due to a java.io.FileNotFoundException because it can't find the apk under

../build/intermediates/instant-run-resources/resources-production/

Any idea how to overcome this so that I can run the project with Instant Run?

I'm not sure where to find the missing apk file or how to change the path to look for it in.

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
Hadas Kaminsky
  • 1,285
  • 1
  • 16
  • 39
  • please check [this answer](https://stackoverflow.com/a/35169716/2826147) – Amit Vaghela Nov 14 '17 at 04:49
  • @AmitVaghela I have no problem with enabling/disabling. When I disable Instant Run I am able to run the project with no problem. The thing is I do want to use Instant Run, but when I enable it the apk is not found. – Hadas Kaminsky Nov 14 '17 at 04:59
  • yes, there are some issues with instant run. check https://stackoverflow.com/a/37207831/2826147 – Amit Vaghela Nov 14 '17 at 04:59
  • Thanks @AmitVaghela, I don't see there anything similar to my problem, I still hope to find some solution, for instance a way to configure the apk location or something. – Hadas Kaminsky Nov 14 '17 at 05:28

3 Answers3

12

Have your settings as below,

enter image description here

Otherwise try to clean and re-install (after uninstalling exsisting apk) application.

Dhruv Patel
  • 1,529
  • 1
  • 18
  • 27
  • 3
    This is what I do to enable Instant Run. When I do that I have the problem I explained. Otherwise things work perfectly but without Instant run... Clean doesn't help. – Hadas Kaminsky Nov 14 '17 at 04:54
9

I found the problem and the solution.

In my case the cause was dexcount-gradle-plugin. The plugin is expecting that the package task produces an APK, but that is not true anymore on Instant Run. So they released a new version that disables the process when running with Instant Run.

So I just had to update dexcount to the latest version.

Hadas Kaminsky
  • 1,285
  • 1
  • 16
  • 39
0

Configure your project for Instant Run

Android Studio enables Instant Run by default for projects built using Android plugin for Gradle 2.3.0 and higher. Please checkout this LINK to configure your project for instant run.

jazzbpn
  • 6,441
  • 16
  • 63
  • 99
  • 1
    Thanks but this doesn't tell me anything about the location of the apk, so it doesn't solve my problem. Does it work for you? Where is your Instant Run apk located? – Hadas Kaminsky Nov 14 '17 at 15:56