在Eclipse下导入vlc-android并编译

在Ubuntu14.04下载好了VLC的源码后,VLC的Eclipse工程存放在"vlc-android"目录
root@dzt-VirtualBox:/home/dzt/android_vlc/android# ls
android-headers-gingerbread compile.sh find_modules.sh NEWS
android-headers-hc configure.sh gcc rename_package.sh
android-headers-ics COPYING gen-env.sh vlc
android-libs dump-libs.sh java-libs vlc-android
assets env.sh Makefile
根据官网的提示
Package in Eclipse [optional]
In Eclipse, create a new Android Project from existing source by importing from the vlc-android path.
Import the three projects from the java-libs folder.
Export unsigned/signed apk.
Note: Building against JDK6 is recommended for optimal compatibility (Set Java Compiler Compliance to 1.6).

在Windows的Eclipse下导入vlc-android工程

还要导入java-libs目录下的几个工程

root@dzt-VirtualBox:/home/dzt/android_vlc/android/java-libs# ls -l
总用量 12
drwxrwxrwx 5 root root 4096  7月 21 15:59 appcompat
drwxrwxrwx 5 root root 4096  7月 21 15:59 SlidingMenu
drwxrwxrwx 5 root root 4096  7月 21 15:59 WheelView

官网推荐我们使用JDK6

vlc-android工程导入Eclipse后的目录结构如下

在Eclipse下导入vlc-android并编译

由于project.properties文件关联了三个工程

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-19
android.library.reference.3=../SlidingMenu
android.library.reference.1=../appcompat
android.library.reference.2=../WheelView
所以也要把appcompat 、SlidingMenu 、WheelView这三个工程导入,我的工程都存放在同一目录下

在Eclipse下导入vlc-android并编译

这里只以WheelView为例

1.

在Eclipse下导入vlc-android并编译

2.

在Eclipse下导入vlc-android并编译

3.

在Eclipse下导入vlc-android并编译

导入后的WheelView工程

在Eclipse下导入vlc-android并编译

在VLC工程右键

在Eclipse下导入vlc-android并编译


在Eclipse下导入vlc-android并编译


在Eclipse下导入vlc-android并编译


在Eclipse下导入vlc-android并编译

这时再对VCL工程Clean

在Eclipse下导入vlc-android并编译

对应的APK就生成了

在Eclipse下导入vlc-android并编译

运行后的效果图

在Eclipse下导入vlc-android并编译

在Eclipse下导入vlc-android并编译


相关VLC源码下载:http://download.csdn.net/detail/deng0zhaotai/7661753

这个工程编译出来的apk只适合运行的ARM系列的处理器上,其它MIPS、X86的需要生成不同的库才行

在Eclipse下导入vlc-android并编译

在安装时碰到一个问题,记录下

01-01 04:04:44.050 V/VLC/LibVLC( 1724): Initializing LibVLC
01-01 04:04:44.050 E/VLC/LibVLC/Util( 1724): WARNING: Unable to read libvlcjni.so; cannot check device ABI!
01-01 04:04:44.050 E/VLC/LibVLC/Util( 1724): WARNING: Cannot guarantee correct ABI for this build (may crash)!
01-01 04:04:44.050 W/dalvikvm( 1724): JNI WARNING: JNI method called with exception pending
01-01 04:04:44.050 W/dalvikvm( 1724):              in Lorg/videolan/libvlc/LibVLC;.nativeInit:()V (GetMethodID)
01-01 04:04:44.050 W/dalvikvm( 1724): Pending exception is:
01-01 04:04:44.050 I/dalvikvm( 1724): java.lang.NullPointerException:
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.libvlc.LibVLC.getDeblocking(LibVLC.java:301)
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.libvlc.LibVLC.nativeInit(Native Method)
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.libvlc.LibVLC.init(LibVLC.java:384)
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.vlc.util.VLCInstance.getLibVlcInstance(VLCInstance.java:47)
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.vlc.gui.MainActivity.onCreate(MainActivity.java:171)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.Activity.performCreate(Activity.java:4465)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.os.Looper.loop(Looper.java:137)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.main(ActivityThread.java:4424)
01-01 04:04:44.050 I/dalvikvm( 1724):   at java.lang.reflect.Method.invokeNative(Native Method)
01-01 04:04:44.050 I/dalvikvm( 1724):   at java.lang.reflect.Method.invoke(Method.java:511)
01-01 04:04:44.050 I/dalvikvm( 1724):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-01 04:04:44.050 I/dalvikvm( 1724):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-01 04:04:44.050 I/dalvikvm( 1724):   at dalvik.system.NativeStart.main(Native Method)
01-01 04:04:44.050 I/dalvikvm( 1724): "main" prio=5 tid=1 NATIVE
01-01 04:04:44.050 I/dalvikvm( 1724):   | group="main" sCount=0 dsCount=0 obj=0x40c41460 self=0x6d8e0
01-01 04:04:44.050 I/dalvikvm( 1724):   | sysTid=1724 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1074222084
01-01 04:04:44.050 I/dalvikvm( 1724):   | schedstat=( 0 0 0 ) utm=7 stm=11 core=0
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.libvlc.LibVLC.nativeInit(Native Method)
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.libvlc.LibVLC.init(LibVLC.java:384)
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.vlc.util.VLCInstance.getLibVlcInstance(VLCInstance.java:47)
01-01 04:04:44.050 I/dalvikvm( 1724):   at org.videolan.vlc.gui.MainActivity.onCreate(MainActivity.java:171)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.Activity.performCreate(Activity.java:4465)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.os.Looper.loop(Looper.java:137)
01-01 04:04:44.050 I/dalvikvm( 1724):   at android.app.ActivityThread.main(ActivityThread.java:4424)
01-01 04:04:44.050 I/dalvikvm( 1724):   at java.lang.reflect.Method.invokeNative(Native Method)
01-01 04:04:44.050 I/dalvikvm( 1724):   at java.lang.reflect.Method.invoke(Method.java:511)
01-01 04:04:44.050 I/dalvikvm( 1724):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-01 04:04:44.050 I/dalvikvm( 1724):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-01 04:04:44.050 I/dalvikvm( 1724):   at dalvik.system.NativeStart.main(Native Method)
01-01 04:04:44.050 I/dalvikvm( 1724): 
01-01 04:04:44.050 E/dalvikvm( 1724): VM aborting
01-01 04:04:44.050 F/libc    ( 1724): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
01-01 04:04:44.050 I/dalvikvm( 1724): Wrote stack traces to '/data/anr/traces.txt'
我是在终端上用命令

sh-4.2# cp mnt/card/VLC.apk /system/app/
报了以上错误,后来查看了:/data/data/org.videolan.vlc/lib  目录,发现是空的,后来才使用以下命令安装就可以了

sh-4.2# pm install -r /mnt/card/VLC.apk /system/app/
        pkg: /mnt/card/VLC.apk
        ver: /system/app/
Success


在Eclipse下导入vlc-android并编译

上一篇:WPF之SharpAvi视频录制(AVI)


下一篇:9月Win10杀软大PK