1. Introduction
-----------------------------------------------------------------------------
//采用的Ubuntu(12.04)64位系统
We currently recommend Ubuntu "Precise Pangolin" (12.04) 64Bit. This is what our continuous
integration system "jenkins" is using.
Additionally, building from OSX Snow Leopard is working.
NOTE TO NEW USERS: All lines that are prefixed with the '#'
character are commands that need to be typed into a terminal window /
console (similar to the command prompt for Windows). Note that the '#'
character itself should NOT be typed as part of the command.
-----------------------------------------------------------------------------
2. Installing the required Ubuntu packages
-----------------------------------------------------------------------------
These are the minimum packages necessary for building XBMC. Non-Ubuntu
users will need to get the equivalents.
//安装ubuntu必要的包
# sudo apt-get install build-essential default-jdk git curl autoconf \
unzip zip zlib1g-dev gawk gperf cmake
If you run a 64bit operating system you will also need to get ia32-libs
//如果是64位系统 要装32位兼容包
# sudo apt-get install ia32-libs
The following versions are used on our continuous integration system "jenkins". Other (newer)
versions might work as well.
//Ubuntu系统自带的JDK1.6
JDK: openjdk-6-jdk (java version "1.6.0_27")
JRE: openjre-6-jre (java version "1.6.0_27")
-----------------------------------------------------------------------------
3. Installing and setting up the Android environment
-----------------------------------------------------------------------------
To develop XBMC for Android the Android SDK and NDK are required.
--------------------------------------------------------------------
3.1. Getting the Android SDK and NDK
--------------------------------------------------------------------
//获取SDK 、 NDK
To get the Android SDK, go to http://developer.android.com/sdk and
download the latest version for your operating system. The NDK
can be downloaded from http://developer.android.com/tools/sdk/ndk/
[NOTICE] Compiling XBMC for Android requires Android NDK
Revision r9. For the SDK just use the latest available.
It will work.
After downloading the SDK and NDK extract the files contained in the
archives to your harddisk. For our example we are extracting in the following
directories (this matches the example from tools/depends/README aswell):
//按步骤将文件放入相应的包中
NDK (referenced as <android-ndk> from now on):
/opt/android-ndk-r9d
TOOLCHAIN (arm) (referenced as <android-toolchain-arm> from now on):
/opt/arm-linux-androideabi-4.8-vanilla/android-14
TOOLCHAIN (x86) (referenced as <android-toolchain-x86> from now on):
/opt/x86-linux-4.8-vanilla/android-14
SDK (referenced as <android-sdk> from now on):
/opt/android-sdk-linux
Make sure you have a recent JRE and JDK installed otherwise the
Android SDK will not work. (see point 2.)
--------------------------------------------------------------------
3.2. Installing Android SDK packages
--------------------------------------------------------------------
After having extracted the Android SDK to <android-sdk> you need to
install some android packages using the Android SDK Manager:
//进入android-sdk-linux中进行操作,并更新sdk
# cd <android-sdk>/tools
# ./android update sdk -u -t platform,platform-tool
--------------------------------------------------------------------
3.3. Setup the Android toolchain//建立android工具链
--------------------------------------------------------------------
To be able to compile XBMC and the libraries it depends on for the
Android platform you first need to setup an Android toolchain using
the Android NDK which you earlier extracted to <android-ndk>. The
following commands will create a toolchain suitable for the most
common scenario.
The --install-dir option (and therefore the <android-toolchain-arm>/<android-toolchain-x86> value)
specifies where the resulting toolchain should be installed (your choice).
[NOTICE] XBMC uses the android API Version 14 and gcc version 4.8!
Building for arm architecture:
//进入到android-ndk-r9d包中 进行操作,64位系统
//<android-toolchain-arm>=arm-linux-androideabi-4.8-vanilla
# cd <android-ndk>
# ls platforms
# cd build/tools
# ./make-standalone-toolchain.sh --ndk-dir=../../ \
--install-dir=<android-toolchain-arm>/android-14 --platform=android-14 \
--toolchain=arm-linux-androideabi-4.8 --system=linux-x86_64
Make sure to pick a toolchain for your desired architecture.
--------------------------------------------------------------------
3.4. Create a (new) debug key to sign debug APKs
--------------------------------------------------------------------
All packages must be signed. The following command will generate a
self-signed debug key. If the result is a cryptic error, it
probably just means a debug key already existed, no cause for alarm.
//创建debug key
# keytool -genkey -keystore ~/.android/debug.keystore -v -alias \
androiddebugkey -dname "CN=Android Debug,O=Android,C=US" -keypass \
android -storepass android -keyalg RSA -keysize 2048 -validity 10000
-----------------------------------------------------------------------------
4. Getting the source code
-----------------------------------------------------------------------------
//获取xbmc-android源代码,并更新皮肤
# cd $HOME
# git clone git://github.com/xbmc/xbmc.git xbmc-android
# cd xbmc-android
# git submodule update --init addons/skin.touched
-----------------------------------------------------------------------------
5. How to compile
-----------------------------------------------------------------------------
Compiling XBMC for Android consists of compiling the libraries XBMC depends
on with the Android toolchain and creating an Android Application Package
(APK) which can be installed in an Android system.
--------------------------------------------------------------------
5.1. Building dependencies
--------------------------------------------------------------------
//建立依赖关系
// ./configure --with-tarballs=/opt/xbmc-tarballs \
--host=arm-linux-androideabi \
--with-sdk-path=/opt/android-sdk-linux \
--with-ndk=/opt/android-ndk-r9d \
--with-toolchain=/opt/arm-linux-androideabi-4.8-vanilla/android-14 \
--prefix=/opt/xbmc-depends
# cd $HOME/xbmc-android/tools/depends
# ./bootstrap
# ./configure --help
//可根据tools/depends/README for examples文档进行配置
Run configure with the correct settings for you local configuration.
See tools/depends/README for examples.
Anyone working on the dependencies themselves will want to set the
environment variables specified in ~/.bashrc or similar, to avoid
having to input these with each configure.
//编译依赖关系,花费较长时间 直到出现Dependencies built successfully. 即为成功!
//第一次编译 ,建议用make,这样容易发现并解决问题
# make -j <jobs>
This build was designed to be massively parallel. Don't be afraid to
give it a 'make -j20' or so.
--------------------------------------------------------------------
5.2. Building XBMC
--------------------------------------------------------------------
//编译xbmc源码
# cd $HOME/xbmc-android
# make -C tools/depends/target/xbmc
# make
# make apk
After the first build (assuming bootstrap and configure are successful),
subsequent builds can be run with a simple 'make' and 'make apk'.
5.3安装生成的xbmc apk包到android设备
cd $HOME/xbmc-android
adb devices
adb -s 02efd7ab install -r ./xbmcapp-armeabi-v7a-debug.apk
注:02efd7ab 是设备id,可通过adb devices命令获得