来自:http://wiki.videolan.org/AndroidCompile
This page is an introduction to the compilation of VLC for Android on Linux.
Contents[hide ] |
You can have more details , if needed.
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.
Note: On Debian-based distributions it is better to download Eclipse indigo builds from the official website: http://www.eclipse.org/downloads/ , otherwise it can lead to an error when importing the ADT plugin (see following).
The ADT plugin is required to compile on Android.
See extra information here .
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/platform-tools:$ANDROID_SDK/tools
You need to export the ABI for your device. armeabi-v7a
is for devices with ARMv7 or above, any other device uses armeabi
.
export ANDROID_ABI=armeabi-v7a
or
export ANDROID_ABI=armeabi
If you plan to use an armeabi-v7a device that does not support NEON, you need a build without NEON
export NO_NEON=1
If you plan to use an armeabi device that does not support FPU, you need a build without FPU
export NO_FPU=1
If you plan to use an ARMv5 armeabi device (read: Android Emulator), you need a build without ARMv6
export NO_ARMV6=1
export ANDROID_ABI=armeabi-v7a
export ANDROID_ABI=armeabi-v7a export NO_NEON=1
export ANDROID_ABI=armeabi
export ANDROID_ABI=armeabi export NO_FPU=1
export ANDROID_ABI=armeabi export NO_ARMV6=1
Those exports must be set at all times, notably for the contribs and the configure.
Clone the source from the VLC git!
In your android folder, run:
git clone git://git.videolan.org/vlc-ports/android.git
Read compile.sh first, as it contains some very useful and important information. Then run it:
sh compile.sh
Note: At this point, you will get an autogenerated debug apk in the bin/ folder, signed with a debug key.
In order to build a non-debug package:
sh compile.sh release
Note: At this point, you will get an unsigned release apk in the bin/ folder, which you will have to sign and zipalign .
Note: Building against JDK6 is recommended for optimal compatibility (Set Java Compiler Compliance to 1.6).
Run it and enjoy!
Here are some helpful links if you wish to debug VLC on Android:
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
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.
If you get the following error message you may have have an outdated version of autotools-dev:
Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized
You may first want to check if your distribution has any available updates for this package. Alternatively, you can manually update your config.guess and config.sub files from here: [1] . These files are typically located in /usr/share/misc on Debian based distributions.