Reputation: 5659
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?
Upvotes: 8
Views: 13679
Reputation: 6027
I had the same issue on Windows 10, running from the command line and did the following:
react-native run-android
Upvotes: 0
Reputation: 1210
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)
Upvotes: 7
Reputation: 1455
I have the same issue and also disable Instant Run, I navigate to that path and find out that the folder is empty.
Then I simply rebuild the project and the issue is gone.
(Android Studio v3.0.1)
Upvotes: 0
Reputation: 5236
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.
Upvotes: 1
Reputation: 374
Yeah, I encountered the same problem.
Workouts-> Once the app is installed, it shows indexing and says failed to open app. This is what happened with me. If your case is the same then just install the app and open the app from the emulator by clicking it. the thing is that the app is installed but it isn't opening. So just open it manually
Upvotes: 0