"The requested operation cannot be performed on a file with a user-mapped section open"

I can no longer build my app for android because of this extremely unhelpful build error message. ionic build android always fails regardless of target or whether it’s development or release and this is always the error message. I have absolutely no clue what it means.

This only started partway through the day yesterday after I updated npm and installed ionic-native and ionic-plugin-deeplinks. I was able to create builds with no issue in the morning.

image

It’s always the same error message in a seemingly random drawable folder on a seemingly random image file within.

What on earth does this even mean? Removing and reinstalling the android platform does not fix this. Updating android does not fix this either. I can’t just delete this file either because it’s generated on build.

Update, I thought this was related to the synconset filechooser plugin, but after removing that plugin I’m still getting this. It is a complete crapshoot whether or not I see this error, and it is a different filename every time. And once I get it, it doesn’t stop happening for an indeterminate amount of time. It’s been 2 days in a row.

I don’t suspect that it is Ionic or Android SDK. I suspect that something is locking this particular file.

The message you get is a generic one and not ionic, android-SDK specific.

See:

What processes could be possible culprits for accessing this file? The files in the error message are always generated during ionic run android and I’m running it as soon as I boot up my PC with nothing else open. This even happens if I delete the build folder entirely and try again. When I delete the intermediates folder manually it still does not work. I tried upgrading the Android SDK but that didn’t do anything to fix the problem either.