Search code examples
androidlibvlc

Unable to read libvlcjni.so; cannot check device ABI


I compiled libVlc for android by following the procedure from here The compiled project don't show any error in eclipse but when I run it on device, it throws the following error

05-21 14:37:50.834: D/dalvikvm(14423): GC_CONCURRENT freed 181K, 8% free 9633K/10439K, paused 17ms+7ms, total 62ms
05-21 14:37:51.034: E/VLC/LibVLC/Util(14423): WARNING: Unable to read libvlcjni.so; cannot check device ABI!
05-21 14:37:51.034: E/VLC/LibVLC/Util(14423): WARNING: Cannot guarantee correct ABI for this build (may crash)!
05-21 14:37:51.065: W/VLC/LibVLC(14423): Unable to load the iomx library: java.lang.UnsatisfiedLinkError: Couldn't load iomx-ics: findLibrary returned null
05-21 14:37:51.065: E/VLC/LibVLC(14423): Can't load vlcjni library: java.lang.UnsatisfiedLinkError: Couldn't load vlcjni: findLibrary returned null

Please help me to solve the issue, thanks in advance


Solution

  • You're getting this error because you haven't exported your device's abi, as mentioned in the instructions. I'm going to assume you also didn't follow the section 'Environment Setup' in the documentation. So, do as follows:

    Make sure you've downloaded the NDK, and then run this(with your path) in your terminal:

    export ANDROID_NDK=/path/to/android-ndk>

    Then, compile the .sh file and export your device's (or emulator's abi) as well. The compilation of the .sh file is directly linked to the abi issue since the script handles the abi. You can see this in the code for the script (compile.sh):

    # try to detect NDK version
    REL=$(grep -o '^r[0-9]*.*' $ANDROID_NDK/RELEASE.TXT 2>/dev/null|cut -b2-)
    case "$REL" in
        9*)
            GCCVER=4.8
            CXXSTL="/"${GCCVER}
        ;;
        8?*)
            # we don't use 4.4.3 because it doesn't handle threads correctly.
            # TODO : clang?
            if test -d ${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.7
            # if gcc 4.7 is present, it's there for all the archs (x86, mips, arm)
            then
                # since r8d
                GCCVER=4.7
            else
                GCCVER=4.6
            fi
            CXXSTL="/"${GCCVER}
        ;;
        7|8|*)
            echo "You need the NDKv8b or later"
            exit 1
        ;;
    esac
    
    export GCCVER
    export CXXSTL
    
    # Set up ABI variables
    if [ ${ANDROID_ABI} = "x86" ] ; then
        TARGET_TUPLE="i686-linux-android"
        PATH_HOST="x86"
        HAVE_X86=1
        PLATFORM_SHORT_ARCH="x86"
    elif [ ${ANDROID_ABI} = "mips" ] ; then
        TARGET_TUPLE="mipsel-linux-android"
        PATH_HOST=$TARGET_TUPLE
        HAVE_MIPS=1
        PLATFORM_SHORT_ARCH="mips"
    else
        TARGET_TUPLE="arm-linux-androideabi"
        PATH_HOST=$TARGET_TUPLE
        HAVE_ARM=1
        PLATFORM_SHORT_ARCH="arm"
    fi
    

    I suggest going over the Android Compile documentation again, and follow the instructions step by step.