Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

Android package include soname libraries



  • Hi,

    I am trying to build a .apk package including freeImage librarie but I have this issue:

    E AndroidRuntime: Process: org.qtproject.example.neptuno, PID: 8743
    E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libfreeimage.so.3" not found: needed by /data/app/~~P8GTfirfELNEWfAbc7pmAQ==/org.qtproject.example.neptuno-DEd97mtIH9Ec49fCAn8CGg==/lib/arm/libneptuno_armeabi-v7a.so in namespace classloader-namespace
    E AndroidRuntime: at java.lang.Runtime.load0(Runtime.java:939)
    E AndroidRuntime: at java.lang.System.load(System.java:1628)
    E AndroidRuntime: at org.qtproject.qt5.android.QtNative$4.run(QtNative.java:505)
    E AndroidRuntime: at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:87)
    E AndroidRuntime: at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
    E AndroidRuntime: at java.lang.Thread.run(Thread.java:923)

    This problem is in runtime my apk has this structure:

    lib/
    armeabi-v7a/
    - libfreeimage.so

    I think that the problem is Gradle does not copy .so.X file and my CMake link to libfreeimage.so.3 instead of libfreeimage.so.

    My CMakeLists.txt contains:

    if(ANDROID)
    target_link_libraries(neptuno Qt5::Sql Qt5::Quick Qt5::Qml Qt5::Network Qt5::NetworkAuth Qt5::Widgets
    /home/gabridc/Repositorio/neptuno-forked/App/Libraries/FreeImage/libfreeimage.so)
    endif()

    I hope could help me because I am looking for information about this issue and I dont find anything.

    Thank you !!



  • Unfortunately Android does not support library versioning, so you cannot use libfreeimage.so.3 as extra library. You should link your program directly with libfreeimage.so and copy it 'into apk'. If this isn't possible, then you may try to use static library.



  • @IntruderExcluder thank you so much ! I will follow your advices.


Log in to reply