現象
ビルド時に以下のようなエラーが発生する
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexWithInstantRunSlicesApkForDebug'.
> java.lang.RuntimeException: java.io.FileNotFoundException: /Users/hoge/android_app/app/build/intermediates/instant_run_split_apk_resources/debug/instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
Android Studio 3.4 以降で起こるらしい?
Instant Runが有効な場合に起こる。
対処法
gradle-wrapper.properties
の gradle のバージョンを 5.2 以上にする。
少なくとも 5.4 では動作した。
gradle/wrapper/gradle-wrapper.properties
- distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip