The recent development of streaming media in Android, always wanted to learn a powerful VLC, just take this opportunity to study the vlc-for-android code, to see how excellent open source audio and video player is implemented. This article summarizes how to compile vlc-for-android under the Linux platform.
Compilation environment: Ubuntu 14.04 64BIT,VLC version 2.1.5
Reference article: https://wiki.videolan.org/AndroidCompile/
1. Preparing the compilation environment
Basically in accordance with the introduction of this wiki is enough, in order to successfully complete the compilation, it is recommended to first ensure that the relevant software or dependent libraries have been downloaded, I would like to highlight a few key considerations.
(1) Android SDK: must use SDK Platform Android 5.0, API 21, because vlc-for-android use some of the Android 5.0 API.
(2) It is best to install the following dependent software through Apt-get installation, or update to the latest version
Git,apache-ant (or Ant), autoconf, Automake, Autopoint, CMake, gawk (or Nawk), GCC, g++, Libtool, M4, Patch, Pkg-config, R Agel, Subversion, unzip.
2. Download the source package
Download Vlc-for-android the latest source code directly from Git:
1 |
git clone git: //git .videolan.org /vlc-ports/android .git |
3. Compiling VLC source and VLC Android project
(1) Configuring the compilation environment variable
Specific reference wiki introduction, you can write a shell script to do, to avoid each compilation to be configured, below is my environment variable, can be modified according to your path:
123456 |
#! /bin/sh export ANDROID_SDK= /opt/android/sdk/ export ANDROID_NDK= /opt/android/android-ndk-r10/ export ANT_DIR= /opt/android/ant/ export PATH=$PATH:$ANDROID_SDK /platform-tools :$ANDROID_SDK /tools :$ANT_DIR export ANDROID_ABI=armeabi-v7a |
(2) Perform compilation
VLC is worthy of using such a wide range of players, its compilation script is written very powerful and intelligent, directly by executing compile.sh, it will automatically check all dependencies and download the missing library through the network.
First, it will download VLC source code and store it in the current directory. Then go to download the dependent third-party library file.
Of course, due to the existence of GFW, sometimes the download will fail, this time, you need to manually go to Google search It is downloading the dependent files, manually downloaded and then placed in the Vlc/contrib/tarballs directory, and then back to the command line to re-execute SH compile.sh
All third-party library files it relies on:
(3) Compile problem
The compilation process was smooth and there was only one big problem, as follows:
123 |
google /protobuf/unittest .proto:853:21: Missing field number. google /protobuf/unittest .proto:862:1: Reached end of input in message definition (missing ‘}‘ ). make [3]: *** [unittest_proto_middleman] Error 1 |
Online also can't find the solution, I looked down on GitHub Protobuf's readme, and then downloaded the latest protobuf put to vlc/contrib/tarballs/ Contrib-android-arm-linux-androideabi/protobuf directory, execute./configure--disable-shared, then compile, did not expect to go directly.
4. Loading the Java project for Vlc-for-android
After compiling the pass, you can see the debug version of the APK directly in the Vlc-android/bin directory, and the following is simply the whole project of loading vlc-android in eclipse.
Open Eclipse, select Import, put all the works in the Vlc-for-android directory into eclipse (I removed the TV project), there are 5 required projects, of which VLC is the main project and the other four are LIB projects. No surprises, just run the VLC project and you can see the VLC Player app on your Android phone!
5. Summary
Vlc-for-android the compilation process is simply introduced here, have any questions welcome message discussion or letter [email protected] exchange.
Android Development Practice: Compiling vlc-for-android