Transferred from: http://blog.csdn.net/asircao/article/details/7734201
System: ubuntu12.04
Code: Git://git.videolan.org/vlc-ports/android.git
Code version: 375646994d0602
At the beginning of the year the three-month VLC Android was engaged. Yesterday saw VLC Android beta release released, decided to compile a look at the effect. The compilation process of their own this record, for friends to reference. The file path below will be replaced by the correct path.
1. Build Ubuntu Android Development environment
To find a directory of your liking install JDK, SDK, NDK, ANT
1.1 Installing the JDK
Refer to my forwarded "Ubuntu11.10 installation Jdk-6u30-linux-i586.bin"
1.2 Installing the SDK
Download sdk:http://developer.android.com/sdk/index.html
Unzip the SDK into a directory:
- $ sudo tar-xvf android-sdk_r20-linux.tgz
1.3 Installing the NDK
Download ndk:http://developer.android.com/tools/sdk/ndk/index.html
Unzip the NDK into a directory:
- $ sudo bzip2-d android-ndk-r5b-linux-x86.tar.bz2
- $ sudo tar-xvf Android-ndk-r5b-linux-x86.tar
1.4 Installing Ant
Download ant:http://mirror.bit.edu.cn/apache//ant/binaries/apache-ant-1.8.4-bin.tar.gz
Extract:
- $ sudo tar-xvf apache-ant-1.8.4-bin.tar.gz
To set the ANT environment variable:
- $ sudo vim/etc/profile
Add at the end of the file:
- Export ant_home=/home/workenv/apache-ant-1.8.4
- Path= $PATH:/home/workenv/apache-ant-1.8.4
Settings to take effect:
- $ source/etc/profile
Check to see if the installation was successful:
- $ ant-version
Should show:
- Apache Ant (TM) version 1.8.4 compiled on 22 2012
1.5 Installing eclipse:
- $ sudo cp eclipse-jee-indigo-sr1-linux-gtk.tar.gz. /workenv/
- $ CD. /workenv/
- $ sudo gzip-d eclipse-jee-indigo-sr1-linux-gtk.tar.gz
- $ sudo tar-xvf Eclipse-jee-indigo-sr1-linux-gtk.tar
- $ sudo chmod 777-r eclipse/
- $ RM Eclipse-jee-indigo-sr1-linux-gtk.tar
1.6 Installing the ADT Plugin
- $./eclips
Launch Eclipse Select "Help" > "Installnewsoftware ..."
Select Add Name:adt location:http://dl-ssl.google.com/android/eclipse/
Selection: Androidddms and Androiddevelopmenttools
1.7 Updating the Android SDK API
- $./eclips
Windows > Preferences > Android > SDK location
Fill in the path to the SDK.
Windows > Android SDK Manger
Select 2.2 and 4.1
Install
2. Install other libraries that VLC relies on:
- $ sudo apt-get build-dep VLC
3. Compiling
3.1 Setting environment variables
- $ Export Android_sdk=/home/workenv/android-sdk-linux
- $ Export ANDROID_NDK=/HOME/WORKENV/ANDROID-NDK-R8
- $ export path= $PATH: $ANDROID _sdk/platform-tools: $ANDROID _sdk/tools If the device is ARMv7 and above and supports neon:
- $ Export android_abi=armeabi-v7a
If the device is ARMv7 and above but does not support neon:
- $ Export android_abi=armeabi-v7a
- $ Export No_neon=1
How do I check the CPU type and support neon? Open the phone or pad under the file/proc/cpuinfo, you will see something like the following:
- Processor:armv7 Processor Rev 2 (V7L)
- bogomips:998.36
- FEATURES:SWP half thumb fastmult vfp edsp neon Vfpv3
- CPU implementer:0x41
- CPU Architecture:7
- CPU variant:0x3
- CPU PART:0XC08
- CPU Revision:2
- Hardware:p1lite Samsung Board
- revision:0004
- serial:0000000000000000
Here can go to ARMv7 and support neon,features have neon, it means support neon, otherwise not support.
3.2 Getting the Code
- $ git clone git://git.videolan.org/vlc-ports/android.git
- $ cd Android
3.3 Compiling
- $ sh compile.sh
The execution of compile.sh is the whole process of compiling, and the approximate process is as follows:
A. Download VLC code: COMPILE.SH's 42 line git clone git://git.videolan.org/vlc.git VLC.
B. And check out the VLC code to e75d2024 this version: compile.sh 44 line git checkout-b android ${tested_hash}
C. Compile all required third-party libraries, first download and recompile, this process takes a long time, it may not be successful, if you cannot download some libraries, download them manually and put them in this directory: Android/vlc/contrib/tarballs.
D. Configuring of VLC.
E. VLC compilation.
F. Compile the Android part code and link the VLC so library.
4 Troubleshooting problems that are encountered during compilation
4.1 Error C compiler cannot create executables
- Configure:error:c compiler cannot create executables
- See ' Config.log ' for more details.
Locate Config.log and open:
- $ vim./vlc/contrib/android/a52dec/config.log
An error has been found with this line:
- /home/workenv/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/. /lib/gcc/arm-linux-androideabi/4.4.3/http://www.cnblogs.com/http://www.cnblogs.com/arm-linux-androideabi/bin/ Ld:crtbegin_dynamic.o:no such file:no such file or directory
CRTBEGIN_DYNAMIC.O can not find, go to the NDK directory to find CRTBEGIN_DYNAMIC.O:
- $ find-name CRTBEGIN_DYNAMIC.O
Find a lot:
- ./PLATFORMS/ANDROID-14/ARCH-X86/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-14/ARCH-MIPS/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-14/ARCH-ARM/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-3/ARCH-ARM/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-8/ARCH-ARM/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-5/ARCH-ARM/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-9/ARCH-X86/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-9/ARCH-MIPS/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-9/ARCH-ARM/USR/LIB/CRTBEGIN_DYNAMIC.O
- ./PLATFORMS/ANDROID-4/ARCH-ARM/USR/LIB/CRTBEGIN_DYNAMIC.O
Check Permissions
- $ LL./platforms/android-14/arch-x86/usr/lib/crtbegin_dynamic.o
It should be this reason to find that ordinary users do not have Read permission. Change the file permissions in the NDK:
- $ sudo chmod 755-r android-ndk-r8
Re-compile:
- $ sh compile.sh
There is no prompt for this error.
4.2 Ant Error
- /bin/sh:1: Ant:permission denied
- $ ant-version
Tip No ant is installed, it is already installed, and setting the environment is OK again:
- $ source/etc/profile
4.3
- BUILD FAILED
- /home/workenv/android-sdk-linux/tools/ant/build.xml:518:unable to resolve project target ' android-15 '
- $ vim Vlc-android/project.properties
Change 15 to 16, because just now I installed the SDK API only 8 and 16.
- $ vim Vlc-android/androidmanifest.xml
Change android:targetsdkversion= "15" to android:targetsdkversion= "16"
Finally: BUILD successful
Postscript:
The compilation was smooth because it had been compiled many times before. If a friend encounters problems with some code compilation errors in VLC, it's probably a matter of permissions, git checkout, git am patching. Follow-up I will summarize some VLC Android code architecture aspects, also will long-term study, focus on VLC, hope to communicate with you.
"Go" VLC Android code compilation