Build for android using unity

everything works perfectly inside of my HTC vive when using the unity plugin, but then I go and build it for android to get it working in my oculus quest and none of the pulse engine stuff works at all. How do I go about getting these things working on an android platform?

I took a stab at building the PulseUnity asset in Unity for Android.
I had to install a few andoid sdk packages including the nDK since Pulse is C++ based
I got pretty far, but it was getting pretty bogged down getting my environment setup, and never got back around to it.

I will take a shot at this again and put a little more effort into it and let you know where I get

Thanks for the feedback!

If you just let me know what I would need to do to get started on it I will do my best. I have my android environment fully setup. I think I just need to get those .dll files into .so? I just don’t know how to go about doing that. I’ve never developed using these before, always just in unity and web.

I am not entirely sure
dll and so are really both shared library objects, one for windows and one for *nix systems
I already have a JNI interface for Pulse, so we might just need to get that built for the target android system and figure out how to get it into Gradle to package with your APK

@abray would you say it’s simply a matter of finding the proper CMake commands/toolchains to build the native plugins (so the PulseC lib from the PulseEngine repo) for Android?

If yes, maybe this can help:

No, there’s a jni interface already, so we don’t have to build pulseC in the ndk

I believe what the ndk is doing is creating a jni interface on regular C++ classes for access to Java. Pulse already has that (and it’s well thought out), so really we need to understand the native Android build process and see where we can integrate our provided jni .so file into that build process.

The regular pulse build will build the pulseJNI.so

Then we can also import the Pulse jar file for access to it in the Android Java space

I think

So I am building it all in unity, and yeah it does already have a pulseC.so but I have tried building an apk with both mono and IL2CPP on each cpu target architecture and none of it seems to work. But I also don’t get any errors no matter what I am doing I have no idea what is going on.

I am going to go and build in some debugging stuff into some of the unity scripts and see if that tells me anything.

That PulseC.so was built on Linux (by @abray), I doubt that will work with Android.

Edit: Congrats on being New User of the Month @Ben_Engel :partying_face: Thanks for your contributions so far! (pretty cool feature by Discourse right there…)

So what do I need to do to start working on this to make it run on android? Where can I get the source for it? I’ll go through all of the hard work of porting it as long as I know what I am trying to port. I’d like to add a few other things as well to make expand it into fitting my use case. But that can come later, after it is running on the required hardware.

You can grab pulse source code here : https://gitlab.kitware.com/physiology/engine
You should try building the PulseJNI target
or the PulseEngine target if you want the ndk to automatically wrap it in some JNI thing it needs…

Hello! Just wondering if any traction on this since the last post? :slight_smile: Figured I’d ask before I try to reinvent the wheel

I have not done anything since the last post.

I am trying to get my android environment setup today

Are you just selecting the Android target in the Unity build menu?

Thanks for quick response. I actually just stumbled upon Pulse a few days ago and haven’t gotten around to even building it to Android yet. I was actually holding off until I heard back here. I can try it this evening and let you know. But yes target is Android for build in Unity.

P.s. thanks so much for making this open source and available in Unity. There is so much potential with this engine!

I did attempt build for Android and had the same issue. No errors, but it won’t grab streaming assets.

From what I gather in unity docs, this is apparently a common issue when apps are using StreamingAssets and are built to Android. I am going to mess around with the below this week and see where I land.

1 Like

Thanks for the info.

I got to the point of building my simple asset harness and unity complained about not knowing which plugin to load (with the same name) I assume its referring to the PulseC plugins…

What all did you do in setting up Android for unity? (Just in case I am missing something, which I probably am)

I actually followed a video back when I set it up. I believe I:

  1. Downloaded JDK
  2. Installed Android Studio and downloaded appropriate SDKs
  3. I think I remember pointing Unity to the SDK directory. In the Unity docs it looks like that may have been Unity > Preferences > External Tools . (Sorry I’m away from computer)
  4. Changed build platform in Unity to target Android. Set minimum target to Marshmellow in Player Settings.

Hopefully that’s helpful. Sorry, this has partly been an interesting learning experience for me as of late. Let me know if that works for you.

Privacy Notice