Thursday, 9 September 2021

Android Studio on Mac fails to build with: java.io.FileNotFoundException (Operation not permitted)

I'm facing a persistent issue when trying to build my app on Android Studio. This happens every time I make a code change and then attempt to build.

I can temporarily fix the issue by invalidating the cache and restarting + cleaning + rebuilding. But then I make another code change and the issue arrises again.

Here is a part of the stack trace:

Caused by: java.io.FileNotFoundException: /Users/Kes.Walker/.../app/build/intermediates/javac/productionDebug/classes/.../databinding/ExpandedEventItemBinding.class (Operation not permitted)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:130)
at com.google.common.io.Files$FileByteSource.openStream(Files.java:120)
at com.google.common.io.ByteSource.openBufferedStream(ByteSource.java:105)
at com.android.build.gradle.internal.tasks.JacocoTaskDelegate$JacocoWorkerAction.run(JacocoTaskDelegate.java:379)
... 28 more

Note that the error will come up for different classes each time, it is not an issue with the contents of the class. But the issue does seem to always come from the app/build/ directory.

I am running this on the following Android Studio version:

Android Studio 4.2
Build #AI-202.7660.26.42.7322048, built on April 29, 2021
Runtime version: 11.0.8+10-b944.6916264 x86_64
VM: OpenJDK 64-Bit Server VM by N/A
macOS 10.16
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry: external.system.auto.import.disabled=true

I figure maybe this is a permissions issue? But I have admin rights on this PC and have granted Android Studio full disk access.



from Android Studio on Mac fails to build with: java.io.FileNotFoundException (Operation not permitted)

No comments:

Post a Comment