一、编译环境:
系统:ubuntu-16.04-desktop-amd64.isojdk:1.8
ndk:NDK r11c
sdk:build-tools 24.0.1 api:23
1.参考官方文档:https://wiki.videolan.org/AndroidCompile/
2.下载vlc git clone https://code.videolan.org/videolan/vlc-android.git
sh compile.sh -a <ABI>
例如,编译x86版本命令为sh compile.sh -a x86
二、环境配置
jdkexport JAVA_HOME=/usr/lib/jvm/jdk1.8.0_101
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH={JAVA_HOME}/bin:$PATH
ndk
export ANDROID_NDK=/usr/lib/jvm/android-ndk-r12b
export PATH=$ANDROID_NDK:$PATH
sdk
export ANDROID_SDK=/usr/lib/jvm/android-sdk-linux
export PATH=$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$PATH
三、配置完成后
1.sudo apt-get install automake ant autopoint cmake build-essential libtool
patch pkg-config protobuf-compiler ragel subversion unzip git
2.弯路,需要安装32位的库,如果是64位ubuntu,为了防止后面少走
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install zlib1g:i386 libstdc++6:i386 libc6:i386
3.sh compile.sh
4.编译成功后,会在vlc-android/build/outputs/apk目录下生成编译后的apk包:
四、在编译过程中遇到的问题
1.grep: vlc-android/AndroidManifest.xml: 没有那个文件或目录
FAILURE: Build failed with an exception.
* Where:
Build file '/home/kele/桌面/vlc-android/libvlc/build.gradle' line: 34
* What went wrong:
A problem occurred configuring project ':libvlc'.
> java.io.FileNotFoundException: /home/kele/桌面/vlc-android/vlc-android/AndroidManifest.xml (没有那个文件或目录)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
解决:没有vlc-android 添加上
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':vlc-android'.
> Buildtools 24.0.1 requires Java 1.8 or above. Current JDK version is 1.7.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
解决:添加1.8jdk
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.
Download https://jcenter.bintray.com/com/android/tools/lint/lint-api/25.1.3/lint-api-25.1.3.jar
> Configuring > 0/5 projects > root project > Compiling /home/kele/桌面/vlc-andr> Configuring > 1/5 projects > :api
> Compiling /home/kele/桌面/vlc-android/api/Build tools 24.0.1 missing. Downloading...
Support library repository missing. Downloading...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':api'.
> failed to find Build Tools revision 24.0.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2 mins 50.53 secs
解决:添加Build Tools 24.0.1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4.
Support library repository missing. Downloading...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':api'.
> Could not resolve all dependencies for configuration ':api:_debugCompile'.
> Could not find com.android.support:appcompat-v7:23.1.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
file:/usr/lib/jvm/android-sdk-linux/extras/android/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
file:/usr/lib/jvm/android-sdk-linux/extras/android/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
Required by:
vlc-android:api:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
解决:添加Support library 23
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5.
unzip: cannot find zipfile directory in one of gradle-2.2.1-all.zip or
gradle-2.2.1-all.zip.zip, and cannot find gradle-2.2.1-all.zip.ZIP, period.
解决:compile.sh at Line 81:
wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL}
=>wget ${GRADLE_URL} 2>/dev/null || curl -O -L ${GRADLE_URL}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6.
FAILURE: Build failed with an exception.
* What went wrong:
Could not list contents of '/home/kele/桌面/vlc-android/vlc-android/res/values-iw'. Couldn't follow symbolic link.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
解决:添加res/values-iw
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7.
android studio 运行时出现的问题
Error:Execution failed for task ':libvlc:buildDebugARMv7'.
> A problem occurred starting process 'command './compile-libvlc.sh''
这个问题未解决 ,有谁遇到这种问题还请指教
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
由于本人初次写博客,不足之处,希望大家指正
qq群:android vlc 462373021
欢迎交流