Why is Unity "Build And Run" treating my old APK like a folder?

Usually when I use build and run on my projects, Unity overwrites the last APK. In this new project, Unity always asks where to store the APK and the old APK is treated like a folder for some reason. This means I have to delete the old APK before building a new one, which is a bit of a pain.

For context, I am working on an XR project in Unity 2021.3.21f1. I am using Unity’s XR plugins with whatever is required to build to Meta Quest devices. I am saving APKs to a builds folder on my desktop. I have built to Meta Quest devices before on other projects without a problem like this (also to my desktop just a different folder).

Also, I can’t just delete the folder in my pop up window and hit save. I get an error that says the file is unavailable. I have to delete the folder, exit, and build and run again. Instead of doing this, I have just been keeping the builds folder open in file explorer. I always delete it before hitting build and run.

Having the same issue here, Unity 2021.3.22f1

This is more likely an issue with windows and the save dialog (which comes from the OS) than with Unity. Since the save dialog identifies the apk file as a folder, that’s the main issue here. We don’t know what Windows version you’re on. Windows supports the concept of “zip folder” for a long time. Maybe it’s a windows 11 thing? On my machine apks are not recognised as zip folders (even though an apk file of course simply is a zip file).

You could try to simply disable Zip folders completely or check if the extension apk is actually linked to that “CompressedFolder” class and remove just that.

Are you by any chance on Windows11?

same here. at some point, Ii started to create a folder instead of create a file.
unity 2021.3.23

it creates the folder if you press “build & run” and you have the device connected.
if you press just “build”, it saves the APK.