Run the app in android emulator after ejecting gives EPERM: operation not permitted, lstat

Hello. I wanted to eject and start a freshly created app in my android emulator and it seems to be not working. I’m on Windows 10 machine and I’m using Powershell opened as administrator. Steps to reproduce:

  1. I started with expo init test
    2 cd test and npm run eject with option to use ExpoKit. After i let my android studio to build the project.
  2. open android studio and wait until it builds a project
  3. run expo start
  4. run application from android studio or use react-native run-android

the expo start console returns message like below

[15:00:46] events.js:183
[15:00:46]       throw er; // Unhandled 'error' event
[15:00:46]       ^
[15:00:46]
[15:00:46] Error: EPERM: operation not permitted, lstat 'C:\users\xxxx\Desktop\dev\test\android\app\build\generated\source\r\devMinSdkDevKernel\debug\android\arch\lifecycle\livedata\core\R.java'

and my androidstudio console returns Could not delete path 'C:\Users\xxxx\Desktop\dev\test\android\app\build\generated\source\r\devMinSdkDevKernel\debug\android\arch\lifecycle\livedata'.

Doesn’t anyone know where the problem can be? Thanks a lot!

Hi @sebinq - sorry for the slow followup here. It sounds like there is an open file handle in the folder that needs to be cleaned as part of the build process. Could you try closing all of your processes, cleaning your build directory (gradlew clean in the android project directory) and then running expo start and building the project in android studio again?

Also note that react-native run-android will not work with ExpoKit projects – we recommend that you use the android/run.sh script instead (or just run the project from the Android Studio GUI).

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.