Android development practices: compiling VLC-for-android,

Source: Internet
Author: User

Android development practices: compiling VLC-for-android,

Recently, I have been developing streaming media on Android and want to learn more about the powerful VLC. I just took this opportunity to study the VLC-for-android code, let's see how an excellent open-source audio/video player is implemented. This article summarizes how to compile VLC-for-android on the Linux platform.

 

Compiling environment: Ubuntu 14.04 64bit, VLC version 2.1.5

 

Reference: https://wiki.videolan.org/AndroidCompile/

 

1. Prepare the compiling environment

 

Basically, it is enough to follow the introduction of this wiki. In order to complete compilation smoothly, we recommend that you first ensure that the relevant software or dependent libraries have been downloaded. I will emphasize several important considerations.

 

(1) Android SDK: you must use the SDK Platform Android 5.0 and API 21 because VLC-for-android uses some Android 5.0 APIs.

 

(2) it is best to install the following dependent software through apt-get install, or update it to the latest version.

Git, apache-ant (or ant), autoconf, automake, autopoint, cmake, gawk (or nawk), gcc, g ++, libtool, m4, patch, pkg-config, ragel, subversion, unzip.

 

2. Download the source code package

 

Download the latest VLC-for-android source code through git:

 

1 git clone git://git.videolan.org/vlc-ports/android.git

 

3. Compile the VLC source code and the VLC Android Project

 

(1) configure the compiling environment variable

 

For details, refer to the wiki introduction. You can write a shell script to execute the script to avoid configuration every time you compile the script. The following is my environment variable and can be modified according to your path:

 

123456 #! /bin/shexport 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_DIRexport ANDROID_ABI=armeabi-v7a

 

(2) execute Compilation

 

1 sh compile.sh

 

VLC is a widely used player, and its compilation script is very powerful and intelligent, directly by executing compile. sh, which automatically checks all dependencies and downloads the missing libraries through the network.

 

First, it downloads the source code of the vlc and stores it in the current directory. Then download the dependent third-party library file.

 

Of course, due to the existence of GFW, sometimes the download may fail. In this case, you need to manually search for the dependent files it is downloading on Google, after the manual download is completed, put it in the vlc/contrib/tarbils directory, and then return to the command line to re-Execute sh compile. sh

 

All third-party library files it depends on:

 

 

(3) compilation problems

 

The compilation process was still smooth, but only one major problem occurred, as shown below:

 

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

 

No solution can be found on the Internet. I checked the Readme of Protobuf on GitHub, download the latest protobuf and put it in the vlc/contrib/tarbils/contrib-android-arm-linux-androideabi/protobuf directory. /configure -- disable-shared, and then compile it. I did not expect it to pass through directly.

 

4. Load the Java project of VLC-For-Android

 

After compilation, you can directly view the debug apk In the vlc-android/bin directory. The following describes how to load the entire project of vlc-android in Eclipse.

Open Eclipse, select Import, and Import all the projects under the vlc-for-android directory to Eclipse (I removed the TV project). There are five required projects, of which, VLC is the main project, and the other four are Lib projects. If there is no accident, run the VLC project directly and you will be able to see the VLC player application on the Android phone!

 

5. Summary

 

Vlc-for-android compilation process will be briefly introduced here, any questions welcome to leave a message to discuss or send a letter to the lujun.hust@gmail.com exchange.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.