Search code examples
androidlibvlc

Develop with LibVLC for android on Windows


I've struggled to even get a demo application running with Android-LibVLC.

I can only find documentation for linux and can't get the application to run on my device (although it compiles).

When I launch the application it logs:

12-16 15:58:19.572    9121-9121/? E/VLC/LibVLC﹕ Can't load vlcjni library: java.lang.UnsatisfiedLinkError: Couldn't load vlcjni from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.compdigitec.libvlcandroidsample-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.compdigitec.libvlcandroidsample-1, /vendor/lib, /system/lib]]]: findLibrary returned null
12-16 15:58:19.667    9135-9135/com.compdigitec.libvlcandroidsample E/VLC/LibVLC﹕ Can't load vlcjni library: java.lang.UnsatisfiedLinkError: Couldn't load vlcjni from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.compdigitec.libvlcandroidsample-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.compdigitec.libvlcandroidsample-1, /vendor/lib, /system/lib]]]: findLibrary returned null

I've compiled the project APK with the org.videolan.libvlc directory classes as part of the source root and with the jni directory in the same module and failed, I've also included the whole VLC module as a separate library module and made it a dependency, this also failed.

Does anybody have a proven method to configure/build an android project with LibVLC, from windows? Or a link to instructions/documentation? (I haven't been able to find anything).

The goal is to replace my android MediaPlayer reliant classes to a library/implementation that supports more filetypes / codecs.


Solution

  • While building in windows your will get warning saying "Android.mk:iomx-hc: non-system libraries in linker flags: -lgcc -lstagefright - lmedia -lbinder" you will get them for multiple files. And it also warns "Android NDK:This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES" So even if you get the builds output it will not have the required files. And hence you are getting the error while running the application.

    Now if you look into Android.mk you will find

    include $(CLEAR_VARS)
    
    LOCAL_MODULE     := libiomx-gingerbread
    LOCAL_SRC_FILES  := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
    LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/modules/codec/omxil $(ANDROID_SYS_HEADERS_GINGERBREAD)/frameworks/base/include $(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include
    LOCAL_CFLAGS     := -Wno-psabi
    LOCAL_LDLIBS     := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder
    
    include $(BUILD_SHARED_LIBRARY)
    

    I downloaded the source of vlc from here and after extracting the source i was able to find "extracted_path"\vlc-2.1.4\modules\codec\omxil\iomx.cpp. So if you can change the include path for VLC_SRC_DIR to the directory where the source of vlc is extracted on WINDOWS machine I think you should be able to compile it. If not use a virtual machine running linux to compile the project.It also requires Archive libraries (.a) which you won't find in the source of vlc. So you will have to first build the source of vlc and then include all the stuff in the project. I think linux in virtual machine is your best bet.