javaandroidgogradlegomobile

Couldn't find "libgojni.so"


After importing a third party library into my Android project, I get the following error:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp-dAIPtULcj_wzNu8vrPvI5Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp-dAIPtULcj_wzNu8vrPvI5Q==/lib/arm, /system/lib, /system/vendor/lib]]] couldn't find "libgojni.so"
    at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
    at java.lang.System.loadLibrary(System.java:1657)
    at go.Seq.<clinit>(Seq.java:37)
    at go.Seq.touch(Seq.java:50)
    at com.fiskaly.kassensichv.sma.Sma.<clinit>(Sma.java:11)
    at com.fiskaly.kassensichv.sma.Sma.invoke(Native Method)

I think this library needs GO to function properly.

How can I implement the GO or better GO MOBILE dependency to my Android project? Can I do it via maven or gradle?


Solution

  • These have to added as src/main/jniLibs/armeabi-v7a/libgojni.so & src/main/jniLibs/arm64-v8a/libgojni.so (jniLibs.srcDir defines that path). golang/mobile has examples. If these are custom JNI bindings, generated with gobind, the native assembly (matching this mysterious 3rd party library) still would need to be placed at the expected locations.