Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

Interesting project there. The Unsatisfied Link error usually means, that the Native Library (probably a Shared Object or something) was not found. Did you run "ndk-build" from Android NDK inside the "jni" folder of the project?

You also said, that you added the Java-Sources from the Library Project to you Java sources. That is probably not the right way to do it. Consider this:

  1. Underlaying those Java Classes there is JNI-Code, that is written in C/C++. What you want to achieve, is that this so-called native code is compiled into a library object that can be loaded/run on Android. To this end, one usually writes an Android.mk file, located in the "JNI" Folder and runs "ndk-build" to build those sources.
  2. There needs to be some Wrapper/Binding Code in Java, that calls those native C/C++ functions. The binding of Java-Calls to C-functions is done by package and class names. Thus, if you move around code, you are likely to destroy those bindings. Unless you know, what you are doing, I would thus recommend, that you leave such an Android Library project, as is and just include the project into your Application Project through Properties -> Android from Eclipse.

Also, you might want to check this project. https://github.com/fscz/FFmpeg-Android

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top