Building Native App confusion for ML2

I am having some confusion regarding making native Apps for ML2,

what is the workflow?
I have visual studio, android studio, Lab2.0, ZI and the other tools ready (C++ compiler, cmake, python etc.)

I had assume, I should be doing the following:
1- Launch Android Studio, and create a C++ App , select the language to be Kotlin or Java.
2- Develop my app as I like in Android Studio inside the cpp files section.
3- Update Gradle to link the specific CMake version, the specific NDK.
4- sign my app
5- somehow replace JNI header and calls with ZI header and calls
6- link against Lumin SDK (I am not sure how to do that yet)

Install it to the device after testing in ZI

If there is a minimal example, where it explains the steps or shows what need to be done, that would be very useful.

1 Like , have you been to our "Native" section under our documentation?

Let me know if this gets you going or if you're still experiencing some ambiguity. But, we do not offer a way to build a "native" ML2 app using Kotlin or Java. You could make an Android app and it would be possible to experience it as a 2D app. Because the device runs on Android, you can adb install mostly any APK and the ML2 will offer an experience that emulates touch with the Controller as if it were a two-dimensional screen.

Thank you for your reply,

I did went through it, and here are my confusion points.
1- The docs seems to explain how to build the samples, and not how the build a native app,
Maybe because I don't have background in android development (I have only done C/C++ desktop applications) but I am missing what my project structure should be, how to use build.gradle to generate apk files.
Because the sample projects seems to use CMake and Gradle (I know how to use Cmake, but not sure how gradle should be used) and such. because native C++ app on android studio, creates a similar but a bit different structure.

2- The vulkancube samples seems to not be working when I try to launch it from ZILAUNCHER
it returns the following error:
log.txt (5.1 KB)

3- I reported this to the other forum, but this seems to be a lot more active, launching ZI crashes if I have Graphics accelerator enabled (I am not sure if this is related to the vulkan error above)
here is the full crash log: (2.3 MB)

1 Like , are you still seeing some ambiguity in the build process?

1 Like


Thank you for your reply,
Right now I am able to deploy the app with no problem using android studio or the build script, I am not sure which part of it was, but some links was leading me to the old documentation from magic leap 1, once I realized that, I had no problem.

but I have the following follow ups:
1- how do I deploy for the host (ZeroIteration) using android studio, I only know how to do it from the python script.

2- Has there been any updates on the ZI crash?
3- Any updates on the Vulkan example?

Ali A.

1 Like

Vulkan Update;

The vulkan cube application does build for the ML2 directly through android studio, but the error still remain when I build for ZI through the python script.

1 Like

Hi, we've updated and renamed Zero Iteration to App Simulator. Have you updated to the latest version of the App Simulator? You can download it from The Magic Leap Hub.

1 Like

I can confirm that the ML2 on MLSDK v1.0 and latest OS doesn't crash and works.


Glad to hear it. Thank you for the update.

1 Like