Saturday, July 28, 2012

Build XBMC for Android on lubuntu 12.04


1. install required packages
# sudo apt-get install build-essential default-jdk git curl autoconf \
   unzip zip zlib1g-dev gawk gperf

2. Getting the Android SDK and NDK
crystax-5 NDK with enabled support of C++ exceptions, RTTI and Standard C++ Library 

3.Installing Android SDK packages
<android-sdk> : $HOME/XBMC_Project/android-sdk-linux
# cd <android-sdk>/tools
# ./android update sdk -u -t platform,platform-tool

4.Setup the Android toolchain
<android-ndk> :  $HOME/XBMC_Project/android-ndk-r8b
<android-toolchain> :  $HOME/XBMC_Project/android_toolchain/android-9
# cd <android-ndk>
# ls platforms
# cd build/tools
# ./make-standalone-toolchain.sh --ndk-dir=../../ \
  --install-dir=<android-toolchain>/android-9 --platform=android-9

5. 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.

# 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

6. Getting the source code
# cd $HOME/XBMC_Project
# git clone git://github.com/xbmc/android.git xbmc-android-git
# cd xbmc-android-git
# git submodule update --init addons/skin.touched

7.Building dependencies
# cd $HOME/XBMC_Project/xbmc-android-git/tools/android/depends
# ./bootstrap
# ./configure --help
#export XBMC_ANDROID_NDK=~/XBMC_Project/android-ndk-r7-crystax-5.beta2
#export XBMC_ANDROID_SDK=~/XBMC_Project/android-sdk-linux
#export XBMC_ANDROID_TARBALLS=~/XBMC_Project/xbmc-tarballs
#./configure --with-toolchain=~/XBMC_Project/android-toolchain/android-9
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for main in -lz... yes
checking for unzip... yes
checking for zip... yes
checking for curl... /usr/bin/curl
checking for tar... /bin/tar
checking for -gcc... no
configure: WARNING: host was not specified. guessing.
checking for gcc... /home/oopsmonk/XBMC_Project/android-toolchain/android-9/arm-linux-androideabi/bin/gcc
        toolchain:       /home/oopsmonk/XBMC_Project/android-toolchain/android-9
        cpu:             armeabi-v7a
        host:            arm-linux-androideabi
        sdk-platform:    android-10
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Makefile.include
#make -j4
make[1]: Leaving directory `/home/oopsmonk/XBMC_Project/xbmc-android-git/tools/android/depends/libssh'
Dependencies built successfully.

8.Building XBMC
#cd ~/XBMC_Project/xbmc-android-git/tools/android/depends/xbmc
#make -j4
APK location : ~/XBMC_Project/xbmc-android-git/xbmcapp-armeabi-v7a-debug.apk
Enjoy it !!

Ref: 

2 comments:

  1. Hi,

    I am building the XBMC for Android.
    I have installed all the dependencies.
    I am getting this error after executing
    ~depends/xbmc$ make
    configure: error: Could not find a required library. Please see the README for your platform.
    make: *** [../../../..//libxbmc.so] Error 1

    Please help me out.

    Thanks
    Vikash

    ReplyDelete
    Replies
    1. Hi Vikash,
      Maybe you should check XBMC_ANDROID_NDK, XBMC_ANDROID_SDK, or any error at building dependencies step.

      Delete