Search code examples
javaandroidgradleandroid-ndkgoogle-project-tango

Tango API linking against private native libraries API24+


Are there any solutions for this problem?

Running the Tango API displays a warning dialog on the library

Our team has the same problem. The guide mentioned doesn't really help. Not "libtango_client_api.so" is private, as far as i did understand:

"libbinder.so"
"libcutils.so"
"libutils.so"
"libgui.so"
"libandroid_runtime.so"
"libui.so"

are the private platform libs we can still use in api version 24, but in 24+ they will not be accessible anymore. The warning also appears on the latest c-examples. There must be a solution for that, caused by the fact that there exists applications without any warnings like this (Rtabmap).

I would be grateful for any help.


Solution

  • I assume you duplicated the question because you are unable to comment yet. I have the same issue so I cannot respond on that thread either but I can give you a workaround which seems very poor but I don't have any other solution.

    For each missing file you can include the prebuilt library as the Developer Site suggests:

    ...you should update your app to either include its own copy of those libraries or only use the public NDK APIs.

    I added the following to the make file and put a copy of the files in the relevant folder:

    include $(CLEAR_VARS)
    LOCAL_MODULE          := binder
    LOCAL_SRC_FILES := ../jni/lib/$(TARGET_ARCH_ABI)/libbinder.so 
    include $(PREBUILT_SHARED_LIBRARY)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE          := cutils
    LOCAL_SRC_FILES := ../jni/lib/$(TARGET_ARCH_ABI)/libcutils.so
    include $(PREBUILT_SHARED_LIBRARY)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE          := utils
    LOCAL_SRC_FILES := ../jni/lib/$(TARGET_ARCH_ABI)/libutils.so
    include $(PREBUILT_SHARED_LIBRARY)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE          := android_runtime
    LOCAL_SRC_FILES := ../jni/lib/$(TARGET_ARCH_ABI)/libandroid_runtime.so
    include $(PREBUILT_SHARED_LIBRARY)
    

    This does not seem like the correct way to do this and I suspect there will be many dependencies. GDB log shows which symbols I cannot load which I will include below. I did start going through one by one seeing which one logcat complained about next in the hope it won't need them all but that may be in vain. I can't believe I have to add all of the following symbols:

    /system/lib64/libcutils.so
    /system/lib64/libutils.so
    /system/lib64/liblog.so
    /system/lib64/libbinder.so
    /system/lib64/libnativeloader.so
    /system/lib64/libandroid_runtime.so
    /system/lib64/libwilhelm.so
    /system/lib64/libc++.so
    /system/lib64/libm.so
    /system/lib64/libbacktrace.so
    /system/lib64/libnativehelper.so
    /system/lib64/libmemtrack.so
    /system/lib64/libandroidfw.so
    /system/lib64/libexpat.so
    /system/lib64/libnetutils.so
    /system/lib64/libui.so
    /system/lib64/libgui.so
    /system/lib64/libinput.so
    /system/lib64/libinputflinger.so
    /system/lib64/libcamera_client.so
    /system/lib64/libcamera_metadata.so
    /system/lib64/libskia.so
    /system/lib64/libsqlite.so
    /system/lib64/libEGL.so
    /system/lib64/libGLESv1_CM.so
    /system/lib64/libGLESv2.so
    /system/lib64/libvulkan.so
    /system/lib64/libETC1.so
    /system/lib64/libhardware.so
    /system/lib64/libhardware_legacy.so
    /system/lib64/libselinux.so
    /system/lib64/libsonivox.so
    /system/lib64/libcrypto.so
    /system/lib64/libssl.so
    /system/lib64/libicuuc.so
    /system/lib64/libicui18n.so
    /system/lib64/libmedia.so
    /system/lib64/libjpeg.so
    /system/lib64/libusbhost.so
    /system/lib64/libharfbuzz_ng.so
    /system/lib64/libz.so
    /system/lib64/libaudioutils.so
    /system/lib64/libpdfium.so
    /system/lib64/libimg_utils.so
    /system/lib64/libnetd_client.so
    /system/lib64/libradio.so
    /system/lib64/libsoundtrigger.so
    /system/lib64/libminikin.so
    /system/lib64/libprocessgroup.so
    /system/lib64/libnativebridge.so
    /system/lib64/libradio_metadata.so
    /system/lib64/libmemunreachable.so
    /system/lib64/libhwui.so
    /system/lib64/libregionalization.so
    /system/lib64/libstagefright.so
    /system/lib64/libstagefright_foundation.so
    /system/lib64/libeffects.so
    /system/lib64/libstagefright_http_support.so
    /system/lib64/libbase.so
    /system/lib64/libunwind.so
    /system/lib64/libstdc++.so
    /system/lib64/libsync.so
    /system/lib64/libpng.so
    /system/lib64/libft2.so
    /system/lib64/libdng_sdk.so
    /system/lib64/libpiex.so
    /system/lib64/libwpa_client.so
    /system/lib64/libpcre.so
    /system/lib64/libpackagelistparser.so
    /system/lib64/libnbaio.so
    /system/lib64/libspeexresampler.so
    /system/lib64/libprotobuf-cpp-lite.so
    /system/lib64/libRS.so
    /system/lib64/libRScpp.so
    /system/lib64/libdrmframework.so
    /system/lib64/libmediautils.so
    /system/lib64/libopus.so
    /system/lib64/libstagefright_omx.so
    /system/lib64/libstagefright_yuv.so
    /system/lib64/libvorbisidec.so
    /system/lib64/libpowermanager.so
    /system/lib64/libstagefright_enc_common.so
    /system/lib64/libstagefright_avc_common.so
    /system/lib64/liblzma.so
    /system/lib64/libbinary_parse.so
    /system/lib64/libimage_type_recognition.so
    /system/lib64/libtiff_directory.so
    /system/lib64/libRS_internal.so
    /system/lib64/libbcinfo.so
    /system/lib64/libLLVM.so
    /system/vendor/lib64/libavenhancements.so
    /system/lib64/libstagefright_httplive.so
    /system/lib64/libmediaplayerservice.so
    /system/lib64/libstagefright_wfd.so
    /system/vendor/lib64/libExtendedExtractor.so
    /system/lib64/libdashplayer.so
    /system/lib64/libart.so
    /system/lib64/libsigchain.so
    /system/lib64/liblz4.so
    /system/framework/arm64/boot.oat
    /system/framework/arm64/boot-core-libart.oat
    /system/framework/arm64/boot-conscrypt.oat
    /system/framework/arm64/boot-okhttp.oat
    /system/framework/arm64/boot-core-junit.oat
    /system/framework/arm64/boot-bouncycastle.oat
    /system/framework/arm64/boot-ext.oat
    /system/framework/arm64/boot-framework.oat
    /system/framework/arm64/boot-telephony-common.oat
    /system/framework/arm64/boot-voip-common.oat
    /system/framework/arm64/boot-ims-common.oat
    /system/framework/arm64/boot-apache-xml.oat
    /system/framework/arm64/boot-org.apache.http.legacy.boot.oat
    /system/framework/arm64/boot-tcmiface.oat
    /system/framework/arm64/boot-telephony-ext.oat
    /system/framework/arm64/boot-WfdCommon.oat
    /system/framework/arm64/boot-oem-services.oat
    /system/framework/arm64/boot-qcom.fmradio.oat
    /system/framework/arm64/boot-qcmediaplayer.oat
    /system/lib64/libandroid.so
    /system/lib64/libcamera2ndk.so
    /system/lib64/libGLESv3.so
    /system/lib64/libjnigraphics.so
    /system/lib64/libmediandk.so
    /system/lib64/libmediadrm.so
    /system/lib64/libOpenMAXAL.so
    /system/lib64/libOpenSLES.so
    /system/lib64/libwebviewchromium_plat_support.so
    /system/vendor/lib64/libOpenCL.so
    /system/vendor/lib64/libgsl.so
    /system/vendor/lib64/libCB.so
    /system/vendor/lib64/libqti_performance.so
    /system/vendor/lib64/libqti-perfd-client.so
    /system/vendor/lib64/libtango_hal.so
    /system/vendor/lib64/libLiftParser.so
    /system/vendor/lib64/libadsprpc.so
    /system/vendor/lib64/libtango_hardware.so
    /system/vendor/lib64/libtango_surface_texture.so
    /system/vendor/lib64/lib-ims-rcscmjni.so
    /system/vendor/lib64/lib-imsrcscmclient.so
    /system/vendor/lib64/lib-imsrcscm.so
    /system/vendor/lib64/lib-imsdpl.so
    /system/vendor/lib64/lib-imsqimf.so
    /system/vendor/lib64/libdiag.so
    /system/vendor/lib64/libqmiservices.so
    /system/vendor/lib64/libdsi_netctrl.so
    /system/vendor/lib64/libtime_genoff.so
    /system/vendor/lib64/lib-imsxml.so
    /system/vendor/lib64/libidl.so
    /system/vendor/lib64/libqmi.so
    /system/vendor/lib64/libqdi.so
    /system/vendor/lib64/libnetmgr.so
    /system/vendor/lib64/libdsutils.so
    /system/vendor/lib64/libconfigdb.so
    /system/vendor/lib64/libqmi_cci.so
    /system/vendor/lib64/libqmi_common_so.so
    /system/vendor/lib64/libqmi_client_qmux.so
    /system/vendor/lib64/libqmi_client_helper.so
    /system/vendor/lib64/libmdmdetect.so
    /system/vendor/lib64/libxml.so
    /system/vendor/lib64/libqmi_encdec.so
    /system/vendor/lib64/libsmemlog.so
    /system/vendor/lib64/lib-imsrcscmservice.so
    /system/vendor/lib64/libcxsparse.so
    /system/lib64/libart-compiler.so
    /system/lib64/libvixl.so
    /system/lib64/libjavacore.so
    /system/lib64/libopenjdk.so
    /system/lib64/libopenjdkjvm.so
    /system/lib64/hw/memtrack.msm8996.so
    /system/vendor/lib64/libqti-at.so
    /system/vendor/lib64/libqti-gt.so
    /system/lib64/libxml2.so
    /system/lib64/libmedia_jni.so
    /system/lib64/libmtp.so
    /system/lib64/libexif.so
    /system/lib64/libstagefright_amrnb_common.so
    /system/lib64/libextmedia_jni.so
    /system/lib64/libjavacrypto.so
    /system/lib64/libkeystore-engine.so
    /system/lib64/libkeystore_binder.so
    /system/lib64/libkeymaster_messages.so
    /system/lib64/libsoftkeymasterdevice.so
    /system/lib64/libkeymaster1.so
    /system/vendor/lib64/egl/libEGL_adreno.so
    /system/vendor/lib64/libadreno_utils.so
    /system/vendor/lib64/egl/libGLESv2_adreno.so
    /system/vendor/lib64/libllvm-glnext.so
    /system/vendor/lib64/egl/libGLESv1_CM_adreno.so
    /system/vendor/lib64/egl/eglSubDriverAndroid.so
    /system/vendor/lib64/hw/gralloc.msm8996.so
    /system/lib64/libmemalloc.so
    /system/lib64/libqdMetaData.so
    /system/lib64/libqdutils.so
    /system/lib64/libqservice.so
    /system/lib64/libcompiler_rt.so
    /system/lib64/libwebviewchromium_loader.so
    /data/app/com.sample.moreteapots-1/oat/arm64/base.odex
    /system/framework/oat/arm64/QPerformance.odex
    

    I will be watching the other thread you referred to which I have upvoted and hope that someone will give us a sensible solution. It seems unlikely that API 24 has only messed up Tango developers.

    I programmatically generated make file code from the log and my program has compiled and run. The Tango config returns null but that is a new issue I suppose. Here are the prebuilt includes. Just add the files to the source path.