在Eclipse下导入vlc-android并编译

时间:2023-03-09 08:25:29
在Eclipse下导入vlc-android并编译

在Ubuntu14.04下载好了VLC的源代码后,VLC的Eclipseproject存放在"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-androidproject

还要导入java-libs文件夹下的几个project

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-androidproject导入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这三个project导入,我的project都存放在同一文件夹下

在Eclipse下导入vlc-android并编译

这里仅仅以WheelView为例

1.

在Eclipse下导入vlc-android并编译

2.

在Eclipse下导入vlc-android并编译

3.

在Eclipse下导入vlc-android并编译

导入后的WheelViewproject

在Eclipse下导入vlc-android并编译

在VLCproject右键

在Eclipse下导入vlc-android并编译

在Eclipse下导入vlc-android并编译

在Eclipse下导入vlc-android并编译

在Eclipse下导入vlc-android并编译

这时再对VCLprojectClean

在Eclipse下导入vlc-android并编译

相应的APK就生成了

在Eclipse下导入vlc-android并编译

执行后的效果图

在Eclipse下导入vlc-android并编译

在Eclipse下导入vlc-android并编译

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

这个project编译出来的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