iotivity-lite
iotivity-lite copied to clipboard
Build for Android Api 27 leads to "UnsatisfiedLinkError: dlopen failed: cannot locate symbol "oc_is_owned_device""
Hello,
I have followed the step to build iotivity-lite for Android as explained here: https://iotivity.org/documentation/building-iotivity-android
The command used to generate it was:
make NDK_HOME=~/android-build/android-arm64-27 ANDROID_API=27 ANDROID_ABI=arm64-v8a IPV4=1 DEBUG=1 SECURE=0
Then I added the iotivity-lite.jar
to my libs
folder and the libiotivity-lite-jni.so
to the src/main/jniLibs/arm64-v8a
.
When I run the app and try to init the stack (dummy code for now):
OcPlatform.getInstance().systemInit(object : OCMainInitHandler {
override fun initialize(): Int {
Log.d("AAAAA", "MyClass-initialize: ")
return 0
// TODO("Not yet implemented")
}
override fun registerResources() {
Log.d("AAAAA", "MyClass-registerResources: ")
// TODO("Not yet implemented")
}
override fun requestEntry() {
Log.d("AAAAA", "MyClass-requestEntry: ")
// TODO("Not yet implemented")
}
})
I get the following error:
2020-09-11 22:22:50.787 23689-23689/my.app.package W/System.err: Native code library failed to load.
2020-09-11 22:22:50.787 23689-23689/my.app.package W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "oc_is_owned_device" referenced by "/data/app/my.app.package-cinCjuUX7hShiEk9-VBcaw==/lib/arm64/libiotivity-lite-jni.so"...
Can anyone point me what I could be doing wrong?
After I removed the SECURE=0 from the make command, this error stopped but a new one raises:
2020-09-14 17:30:58.352 15950-16588/my.app.package W/System.err: Native code library failed to load.
2020-09-14 17:30:58.352 15950-16588/my.app.package W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "coap_remove_observers_on_dos_change" referenced by "/data/app/my.app.package-20v-zis4z74eD6sngNv9yw==/base.apk!/lib/arm64-v8a/libiotivity-lite-jni.so"...
@ampeixoto I'm playing around with the Android port, does the problem occur with the latest master? (This may no longer be relevant, so in case I receive no answer I'll close this issue by the end of the week).