VLC在维基百科中详细描述了vlc在android平台的编译过程,地址如下。
http://wiki.videolan.org/AndroidCompile#Get_VLC_Source
引用
平台:PC vmware Ubuntu 10.04 手机 HTC g18
1准备工作
(1)ANDROID_SDK、ANDROID_NDK、ANDROID_ABI
在前一篇博文中已经介绍了Android sdk/ndk的安装,现在只是再强调一下,SDK和NDK的环境变量命名必须于vlc要求的ANDROID_SDK、ANDROID_NDK一致,直接各处变量:
ANDROID_NDK=$HOME/programFiles/android/android-ndk-r8e
export ANDROID_NDK
ANDROID_SDK=$HOME/programFiles/android/android-sdk-linux
export ANDROID_SDK
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK
下面就是ANDROID_ABI了,通过adb shell登录手机shell,
cd proc
cat cpuinfo
Processor : ARMv7 Processor rev 2 (v7l)
processor : 0
BogoMIPS : 13.52
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x0
CPU part : 0x02d
CPU revision : 2
Hardware : pyramid
Revision : 0080
Serial : 0000000000000000
这里就能到ARMv7并支持neon,Features里有neon,就表示支持neon,否则不支持。
如支持则:
export ANDROID_ABI=armeabi-v7a
否则:
export ANDROID_ABI=armeabi-v7a
export NO_NEON=1
(2)下载ant
http://ant.apache.org/bindownload.cgi
export ANT_HOME=/home/ben/programFiles/apache/apache-ant-1.9.0
export PATH=$PATH:$ANT_HOME/bin
运行ant -version
Apache Ant(TM) version 1.9.0 compiled on March 5 2013
则成功。
(3)安装automake autopoint libtool cmake等一些列工具
2 下载编译vlc源码
git clone git://git.videolan.org/vlc-ports/android.git
编译
sh compile.sh
3 可能会出现的错误
(1) git -B 无法识别的错误,本人将-B 改写为-b
(2) make: *** [http://www.cnblogs.com/contrib/tarballs/libmpeg2-0.5.1.tar.gz] 错误 4
解决办法:因为videolan的下载地址提供的包无法访问下载,手动下载libmpeg2-0.5.1.tar.gz,放在android/vlc /contrib/android目录下。
(3) gzip: stdin: invalid compressed data--crc error
解决办法:重新安装gzip
(4) checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized
configure: error: /bin/bash autotools/config.sub arm-linux-androideabi failed
解决办法:到http://git.savannah.gnu.org /gitweb/?p=config.git;a=tree下载最新的包并解压得到config.guess和config.sub两个文件,将此两个文件拷贝到/usr/share/misc目录下覆盖,重新执行编译命令。
(5) autocofig版本过低
ubuntu10.04 的autoconfig版本低,手动下载安装
wget http://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.68.tar.gz
(6) 没有autopoing
下载autopoint 并安装
(7)BUILD FAILED
/home/wayne/android/android-sdk-linux/tools/ant/build.xml:539: Unable to resolve project target 'android-17'
[url]
http://ppa.launchpad.net/lucid-bleed/ppa/ubuntu/pool/main/g/gettext/autopoint_0.18.1.1-1ubuntu2~ppa1~lucid1_all.deb
[/url]
Total time: 2 seconds
make: *** [vlc-android/bin/VLC-debug.apk] 错误 1
解决方法:在eclipse中安装android17 api或者
gedit vlc-android/AndroidManifest.xml
将targetVersion改为15,前提是有4.03的api
可能根据不同的系统和机器,会出现不同的问题,一一解决之后便会出现如下提示:
BUILD SUCCESSFUL
Total time: 46 seconds
rm android-libs/libmedia.c android-libs/libutils.c android-libs/libstagefright.c android-libs/libbinder.c
Generating environment script.
This is a script that will export many of the variables used in this
script. It will allow you to compile parts of the build without having
to rebuild the entire build (e.g. recompile only the Java part).
To use it, include the script into your shell, like this:
source env.sh
Now, you can use this command to build the Java portion:
make -e
The file will be automatically regenerated by compile.sh, so if you change
your NDK/SDK locations or any build configurations, just re-run this
script (sh compile.sh) and it will automatically update the file.