I think, I generated build jni files with libteec.
Android.mk :
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libteec
LOCAL_SRC_FILES := /home/test/optee_android/out/target/product/hikey/system/lib64/libteec.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
CFG_TEEC_PUBLIC_INCLUDE = /home/test/devel/optee/optee_client/public
LOCAL_STATIC_LIBRARIES := libteec
LOCAL_MODULE := test
LOCAL_SRC_FILES := test.c
LOCAL_C_INCLUDES := $(CFG_TEEC_PUBLIC_INCLUDE) \
/home/test/devel/optee/optee_client/libteec/src/ \
include $(BUILD_SHARED_LIBRARY)
I can generate a apk and it put libteec.so and libtest.so in /data/app/mypackage/lib/arm64/
I also have done these steps:
- “device/linaro/hikey/ueventd.common.rc”, set /dev/teepriv0 and /dev/tee0 from 0660 to 0666
- "device/linaro/hikey/hikey/BoardConfig.mk " add androidboot.selinux=permissive to BOARD_KERNEL_CMDLINE
- "device/linaro/hikey/bootloader/EFI/BOOT/grub.cfg " add androidboot.selinux=permissive (but i don’t know if it is necessary)
But, I took this error when I run my native apk in optee + android.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test.testnative, PID: 3232
**java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++.so" not found**
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at com.tez.mobileidcard.MobileSigningLib.<clinit>(MobileSigningLib.java:6)
at com.tez.mobileidcard.MainActivity.onCreate(MainActivity.java:14)
at android.app.Activity.performCreate(Activity.java:6999)
at android.app.Activity.performCreate(Activity.java:6990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
I have libc++.so in /system/lib64/