Unable to Export APK from Unity - Build Prompts for Folder Instead (Magic Leap 2 Developer Pro)

Give us as much detail as possible regarding the issue you’re experiencing:

Unity Editor version: 6000.1.5f, Unity 2022.3
ML2 OS version: v1.12.0
Unity SDK version: 2.6.0
Host OS: Windows, MacOS

My name is Junsu Song, a graduate student at POSTECH (Pohang University of Science and Technology) in South Korea. I am currently working with the Magic Leap 2 Developer Pro device and am attempting to deploy content developed in Unity onto the headset.

I got to know more about the Magic Leap 2 device through your documentation and guides, which were incredibly helpful.
I was able to successfully set up my Unity environment using the Magic Leap Setup Tool available on the Unity Asset Store.

However, I am currently encountering an issue I cannot resolve.

After importing and applying the Magic Leap Setup Tool in Unity, when I try to Build or Build and Run for Android, Unity does not export an APK file. Instead, it prompts me to select a folder, as shown in the attached screenshots.

I did not enable the “Export Project” option, so I don’t understand why it’s prompting me to select a folder instead of exporting an APK.
This time, I tried setting everything up based on the instructions in the following YouTube video:

However, the same issue still occurred.

I tested this on both Windows and macOS, using Unity 2022.3 LTS and Unity 6, and the result is the same — the build process always asks for a folder instead of generating an APK.

Could you please help me understand why this is happening?

In addition, I have a few more questions:

  1. In many YouTube videos and guides, I see that there is a Magic Leap tab under Preferences > External Tools.
    However, as shown in my screenshot, I do not see that tab in my setup. I’d like to understand why it’s missing.

  2. In Magic Leap Hub 3, under the Developer tab, I have set the custom ADB path as follows:
    /Applications/Unity/Hub/Editor/6000.1.5f1/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb
    Is this the correct setup, or is there another recommended configuration?

I’m very excited about building content using Magic Leap 2 and sharing XR experiences with others. I truly appreciate the tools and ecosystem you provide, and I would be grateful for your help in resolving this issue.




Hey @JunsuSong the issue you are facing is definitely a tricky one to track down in the Unity editor. The issue is a Player setting that exports APKs based on their architecture. It does so by putting all of them into a folder. The option continues to perform the same way, even when a single architecture is selected.

Additionally, if you have issues with your application rendering black, make sure you have the standard Activity selected instead of the GameActivity option in the Player settings.

Thank you very much for your previous response — I really appreciate your help.

On macOS using Unity 2022.3.56f1 LTS, I was able to successfully export an APK file after disabling the Split APKs by target architecture option as shown in the first screenshot you provided.
I then tested Build and Run for Magic Leap 2, and I was happy to see that it worked properly.

However, when I tried using Unity 6000.1.5f1, I encountered a new issue.
As shown in the attached screenshot, the build fails with the following error:

Gradle Error: Resource Not Found
Resource ‘style/BaseUnityGameActivityTheme’ not found in AndroidManifest.xml:88

Because of this error, I’m unable to export the APK.

Would you be able to help me understand what is causing this issue?

Thank you again for your support — I really appreciate it.

This is a simple fix
In Assets/Plugins/Android, find the file AndroidManifest.xml
Open it in a text editor

It will have a line that starts with

<activity android:name=“com.unity3d.player.UnityPlayerGameActivity”

And it will have an attribute with value “style/BaseUnityGameActivityTheme”. Remove attribute and value, so you only have

<activity android:name=“com.unity3d.player.UnityPlayerGameActivity”>

And then it will work

2 Likes