keijiro / KlakHap

HAP video player plugin for Unity
Other
341 stars 27 forks source link

Android port #39

Open Tenacious-R opened 3 years ago

Tenacious-R commented 3 years ago

Trying to port to Android to play small video loops on a ChromeBook,, the Hap larger file size is not an issue as the videos I'm using are quite small.

I was able to build the library .so (tried both arm7 and arm64) but when run on device the videos are blank with an error: DllNotFoundException: Unable to load DLL 'KlakHap': The specified module could not be found.

Looking inside the .apk and the libKlakHap.so is included so I'm not sure what is wrong?

keijiro commented 3 years ago

Did you use the -static-libstdc++ linker option?

https://github.com/keijiro/UnityPluginWithWSL/blob/master/Plugin/Makefile.android#L8

Unity will fail to load the native plugin if it's dynamically linked to libstdc++.

Tenacious-R commented 3 years ago

Yes I tried that but its still not loading. Using Visual Studio I have -static-libstdc++ set in additional dependencies.

keijiro commented 3 years ago

Did you check if the libKlakHap.so is actually your file? This package has a file with the same filename for x86 Linux, so I wonder if Unity could pick it up in a wrong way.

Tenacious-R commented 3 years ago

I have made some progress, I replaced VisualStudio with AndroidStudio and no longer get the DLL not found error instead I am getting a failed to open stream error. I have set PathMode to StreamingAssets and have checked the video is included in the build in the assets folder which appears to match the resolved File Path /base.apk!/assets/v5.mov?

keijiro commented 3 years ago

Unfortunately, I don't have much experience on Android, but I'm pretty sure that that's one of the common problems on Unity/Android dev. Probably, you can find some hints/knowledges by Googling.