Difference between revisions of "AndroidCompile"
m (→Android NDK: obsolete) |
MessiahAndrw (talk | contribs) (→Linux and autotools: added ant to required tools) |
||
Line 145: | Line 145: | ||
You '''MUST''' be on Linux, and a recent one. | You '''MUST''' be on Linux, and a recent one. | ||
− | You '''MUST''' have installed: ''autoconf'', ''automake'', ''libtool'', ''gcc'', ''g++'', ''pkg-config'', ''cmake'', ''patch'', ''subversion''. And very up-to-date versions of those tools. | + | You '''MUST''' have installed: ''apache-ant'', ''autoconf'', ''automake'', ''libtool'', ''gcc'', ''g++'', ''pkg-config'', ''cmake'', ''patch'', ''subversion''. And very up-to-date versions of those tools. |
− | You '''MUST''' install: ''git''. | + | You '''MUST''' install: ''git''. |
=== Environment === | === Environment === |
Revision as of 00:22, 31 January 2012
This page is an introduction to compilation of VLC for Android on Linux.
Contents
Eclipse, SDK and NDK installation
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.
- 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.
Note: If you use the Android v7 NDK, replace your /vlc-android/build.xml file as follows:
<?xml version="1.0" encoding="UTF-8"?> <project name="VLC" default="help"> <!-- The local.properties file is created and updated by the 'android' tool. It contains the path to the SDK. It should *NOT* be checked into Version Control Systems. --> <loadproperties srcFile="local.properties" /> <!-- The ant.properties file can be created by you. It is only edited by the 'android' tool to add properties to it. This is the place to change some Ant specific build properties. Here are some properties you may want to change/update: source.dir The name of the source directory. Default is 'src'. out.dir The name of the output directory. Default is 'bin'. For other overridable properties, look at the beginning of the rules files in the SDK, at tools/ant/build.xml Properties related to the SDK location or the project target should be updated using the 'android' tool with the 'update' action. This file is an integral part of the build system for your application and should be checked into Version Control Systems. --> <property file="ant.properties" /> <!-- The project.properties file is created and updated by the 'android' tool, as well as ADT. This contains project specific properties such as project target, and library dependencies. Lower level build properties are stored in ant.properties (or in .classpath for Eclipse projects). This file is an integral part of the build system for your application and should be checked into Version Control Systems. --> <loadproperties srcFile="project.properties" /> <!-- quick check on sdk.dir --> <fail message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'" unless="sdk.dir" /> <!-- extension targets. Uncomment the ones where you want to do custom work in between standard targets --> <!-- <target name="-pre-build"> </target> <target name="-pre-compile"> </target> /* This is typically used for code obfuscation. Compiled code location: ${out.classes.absolute.dir} If this is not done in place, override ${out.dex.input.absolute.dir} */ <target name="-post-compile"> </target> --> <!-- Import the actual build file. To customize existing targets, there are two options: - Customize only one target: - copy/paste the target into this file, *before* the <import> task. - customize it to your needs. - Customize the whole content of build.xml - copy/paste the content of the rules files (minus the top node) into this file, replacing the <import> task. - customize to your needs. *********************** ****** IMPORTANT ****** *********************** In all cases you must update the value of version-tag below to read 'custom' instead of an integer, in order to avoid having your file be overridden by tools such as "android update project" --> <!-- version-tag: 1 --> <import file="${sdk.dir}/tools/ant/build.xml" /> </project>
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
Linux and autotools
You MUST be on Linux, and a recent one.
You MUST have installed: apache-ant, autoconf, automake, libtool, gcc, g++, pkg-config, cmake, patch, subversion. And very up-to-date versions of those tools.
You MUST install: git.
Environment
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.
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!