How to bundle native files


I’m using LibGdx + MOE to compile for iOS. I created a small but important native file, which i compiled for all platforms i will run on. Its working fine on win32/java and android, but i’m trying for 2 days to make it work on iOS/MOE.

I saw the Gradle config that it searches for a natives-ios.jar file somewhere. I placed my native code on a file with that name, which contains:

I deleted the tv* files.

Where do i have to place this jar file to make it include and be findable when the application runs? I keep getting ÜnsatisfiedLinkError.

thanks in advance


You have to link it somehow as a static library since iOS doesn’t allow apps to load dynamic libraries during runtime. Maybe try making an ios framework for that? Or you could ref to how libgdx did to link its own native libraries. See copyNatives task in your gradle file, pay attention to the line with LD_FLAGS as this is the command to tell xcode to link your library to the app’s main executable.

It worked! I was doing exactly what you said, i added the file to the LD_FLAGS and it worked.

LD_FLAGS += " -force_load ${SRCROOT}/native/ios/libnative-utils-lib.a"

… and now i can go sleep well :slight_smile: