AndroidCompile
This page is an introduction to compilation of VLC for Android on Linux.
Contents
Eclipse, SDK and NDK installation
Requirements
- You MUST be on Linux, and a recent one.
- You MUST have installed: apache-ant (or ant), autoconf, automake, autopoint, libtool, gawk (or nawk), gcc, g++, pkg-config, cmake, patch, subversion. And very up-to-date versions of those tools.
- You MUST install: git.
Android SDK
- Create a working directory android.
- Go to Android SDK page and download android-sdk_r10-linux_x86.tgz.
- Decompress into android folder.
- Run tools/android (from the command line you can also run: "tools/android update sdk -u -t platform,platform-tool,extra")
- In the tool, install "SDK Platform Android 2.3, API 10", and follow the instructions.
You can have more details, if needed.
Android NDK
- Check that the SDK installation is correct.
- Go to Android NDK page.
- Download http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2.
- Decompress into android folder, next to your android-sdk-linux_x86 folder.
Eclipse
As used by your distribution, install Eclipse with your package manager:
apt-get install eclipse (debian) yum install eclipse (Fedora) pacman -S eclipse (Arch) emerge -av eclipse-sdk (Gentoo) ...
And run it, at least once, and then quit eclipse.
ADT
The ADT plugin is required to compile on Android.
- Go to ADT page.
- Start Eclipse, then select Help > Install New Software....
- Add the "ADT Plugin" repository with https://dl-ssl.google.com/android/eclipse/ as URL
- Validate and select the checkbox next to Developer Tools and click Next, Next, Finish.
- Restart Eclipse.
- Go to Menu > Window > Preferences... and then Android from the left pane.
- Point the SDK Location in to your downloaded SDK directory.
- Ok, and quit Eclipse.
Environment setup
Set $ANDROID_SDK to point to your Android SDK directory
export ANDROID_SDK=/path/to/android-sdk
Set $ANDROID_NDK to point to your Android NDK directory
export ANDROID_NDK=/path/to/android-ndk
Add some useful binaries to your $PATH
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
If you plan to use the emulator or if you have a phone that does not support NEON, you need a build without NEON
export NO_NEON=1
Those exports must be set at all times, notably for the contribs and the configure.
Building
Get VLC Source
Use the VLC git repository to get the source!
In your android folder, run:
git clone git://git.videolan.org/vlc-ports/android.git
Compile
Read compile.sh first, as it contains some very useful important information. Then run it:
sh compile.sh
Package in Eclipse
- In Eclipse, create a new Android project from existing source by giving the vlc-android path.
- Compile your project using Eclipse.
Run
Run it and enjoy!
Debugging
Here are some helpful links if you wish to debug VLC on Android:
Troubleshooting
Outdated Awk
If you receive the error message while building:
Android NDK: Host 'awk' tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !
The prebuilt version of Awk that comes with the Android NDK is outdated. Defining HOST_AWK in your environment does nothing as the system still tries to just the one that comes with the Android NDK. To get around this issue, simply rename or delete the Awk binary that comes with the Android NDK. For example to move it:
mv $ANDROID_NDK/prebuilt/linux-x86/bin/awk $ANDROID_NDK/prebuilt/linux-x86/bin/awk.old
Can't find Ant
If you're new to Ant, please be aware that some Linux distributions don't install it in the usual spot as with other programs. Try checking to see if the directory /usr/share/java/apache-ant/bin exists and add it to your path.