My Environment:
Android Studio 2.1.2
Android Gradle Plugin v2.1.2
Mac OSX v10.11.5
Up until now, I have turned off Instant Run when calling "Build=>clean Project" and running my project. The reason I have turned off Instant Run is because of this and this issue. However, recently, I started running into this problem every time I try to clean my project:
Error:Could not read path
<path/to/app/module>/build/intermediates/classes/release/com/<package/name>/R$layout.class'.
The interesting thing about this is that the specific file path that it can't find appears to be random. For example, if I call Gradle sync and then clean again, it will fail with this error:
Error:Could not read path
<path/to/app/module>/build/intermediates/classes/release/com/<different/package/name>$ProductCategoryAdapter$1.class'.`
Steps to Reproduce:
Workaround
The current workaround is to re-enable Instant Run. However, that will also bring back the reason for turning it off.
Questions
1) Has anyone else encountered this problem?
2) Are there any other possible workarounds or even better yet, a solution to this problem?
To all the viewers visiting this page, as per my recent experience, 'Invalidate Cache & Restart' solves the problem. No need to disable/enable instant run and deleting folders manually. (Android Studio 3.0.1)
I face the same problem. When i go to that address in explorer i see i can not open the folder and it gives permission error. So i close the Android studio and delete that specific folder from app/build directory and then restart the android studio.
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