[Android Krypton Compile Guide] Step by Step
#1
How to build Kodi Krypton for Android with no compiler errors.
This is based on xbmc/docs/README.android. I just filled in
the blanks that README.android had. The APK was tested on
Amazon FireTV.

After many hours of trying to compile Kodi for Android, I thought I could
share my steps to help prevent headaches. This is a step by step guide.
This will work with both Windows 7, and OSX (because we are using Virtual box.)

There are less things to go wrong when you start with a fresh install of the
operating system.
-----------------------------------------------
Starting Environment:
Ubuntu 16.04 LTS 64 bit(running on Windows 7 Virtual Box 5.1.14)
javac 1.8.0_121
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
-----------------------------------------------

** Here are the steps:

----------------------
1) Install VirtualBox, then make a Linux Virtual Machine
----------------------
VirtualBox on Windows 7 host. A 30GB expandable disk for Linux is plenty.
Ubuntu 16.04 LTS 64 bit(running on Windows 7 Virtual Box)

----------------------
2) Prepare the Ubuntu installation:
----------------------
$ sudo apt-get update
$ sudo apt-get install default-jdk
$ sudo apt-get install build-essential default-jdk git curl autoconf \
unzip zip zlib1g-dev gawk gperf cmake

$ sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev
$ sudo apt-get install libcurl4-openssl-dev

----------------------
3) Get Android SDK & NDK
----------------------
a) SDK tools
$ mkdir $HOME/android-sdk-linux

get the sdk tools from the link below:
https://dl.google.com/android/repository...-linux.zip
uncompress tools_r25.2.3-linux.zip to: /$HOME/android-sdk-linux/

$ cd /$HOME/android-sdk-linux/tools
$ ./android update sdk -u -t platform,platform-tool
$ ./android update sdk --all -u -t build-tools-20.0.0

b) NDK
get the NDK from the link below
https://dl.google.com/android/repository...x86_64.zip
uncompress android-ndk-r12b-linux-x86_64.zip to /$HOME/
so you'll have: /$HOME/android-ndk-r12b

----------------------
4) Set up the Android tool chain
----------------------
$ cd /$HOME/android-ndk-r12b
$ cd build/tools
$ ./make-standalone-toolchain.sh --ndk-dir=../../ \
--install-dir=/$HOME/arm-linux-androideabi-4.9-vanilla/android-21 --platform=android-21 \
--toolchain=arm-linux-androideabi-4.9

----------------------
5) Creat debug key to sign for the APK
----------------------
$ 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) Get the source code — this gets me Kodi version 17 RC1
VERSION_MAJOR 17 / VERSION_MINOR 1 / VERSION_TAG RC1
VERSION_CODE 170901 / ADDON_API 17.0.901
----------------------
$ cd $HOME
$ git clone -b Krypton git://github.com/xbmc/xbmc.git kodi-krypton
$ cd kodi-krypton

----------------------
8) Building dependencies
----------------------
$ cd $HOME/kodi-krypton/tools/depends
$ ./bootstrap
$ ./configure --with-tarballs=/$HOME/xbmc-tarballs --host=arm-linux-androideabi --with-sdk-path=/$HOME/android-sdk-linux --with-ndk=/$HOME/android-ndk-r12b --with-toolchain=/$HOME/arm-linux-androideabi-4.9-vanilla/android-21 --prefix=/$HOME/xbmc-depends

-- this next two steps would take a while. I did not follow the advice to use make -j
$ make
$ make -C target/binary-addons

----------------------
9) Building Kodi.Finally!!!! The instructions in the readme.Android are not updated.
The two lines with * are completely different than the README file.
----------------------
$ cd $HOME/kodi-krypton
* $ make -C tools/depends/target/cmakebuildsys
* $ cd /kodi-krypton/build
$ make
$ make apk

you’ll get your apk in $HOME/kodi-krypton
Reply
#2
How about you update the instructions?
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#3
Done: PR 11630

https://github.com/xbmc/xbmc/pull/11630
Reply
#4
I am attempting to follow your guide. However, when I attempt to build the dependencies (step 8 'make' command) I get the following error:

recipe for target 'libtool-native' failed
*** [libtool-native] Error 2
recipe for target 'native/.installed-x86_64-linux-native' failed


Any idea of how to fix this?

Thanks
Reply
#5
Never mind. I got it working. Thanks for your guide.
Reply
#6
Can you share your solution in case others have the same error?

Sent from my X15
Reply
#7
The way I fixed the error I mentioned was to downgrade from gcc 6 to 5.4. However, I'm still having trouble with the dependencies not building. I'm actually attempting to build a different version of Kodi, so I'm going to move my issues to a new thread.
Reply
#8
This guide works great. Superb effort.


Sent from my iPad
Reply
#9
So I finally was able to get all the dependencies to build correctly. From that point on things went well until I got to the last command "make apk". I'm getting an error:

recipe for target 'CMakeFiles/bundle' failed

Any idea of how to fix this?
Reply
#10
@mattfred, I only tried these steps on Kodi 17rc1. For good measures, (even though it is identical) I went through the steps start to finish on OSX and Windows 7 VirtualBox. Are you building for a different version?
Are your starting environment the same as the ones stated? It may be drastic, but getting the source again (either in a different directory tree, or rm -rf bomb the current source tree and redo, or rename your current kodi source tree if you want to keep the compiled files.)

Looks like OptimusGREEN was able to independently verify that the instructions work.

Please keep me posted.
Thank you
Reply
#11
Yeah working for me thanks. The log is a debug log though. Is there an alternative make command for the log to be a non debug?

Sent from my X15
Reply
#12
debug log:
http://kodi.wiki/view/Log_file/Advanced
Reply
#13
This works (thanks, ScopeFan!). But it differs from https://github.com/xbmc/xbmc/tree/master...u-makefile, which didn't work for me (I don't have the output handy, and not asking for debugging help.) Can anybody shed light on why there are two different ways, and why someone would pick one over the other? (I think the suggestion to use cmakebuildsys comes from wsnipex elsewhere on the forum).
Reply
#14
(2017-02-06, 07:48)ScopeFan Wrote: ----------------------
3) Get Android SDK & NDK
----------------------
a) SDK tools
$ mkdir $HOME/android-sdk-linux

get the sdk tools from the link below:
https://dl.google.com/android/repository...-linux.zip
uncompress tools_r25.2.3-linux.zip to: /$HOME/android-sdk-linux/

$ cd /$HOME/android-sdk-linux/tools
$ ./android update sdk -u -t platform,platform-tool
$ ./android update sdk --all -u -t build-tools-20.0.0

I downloaded the latest Android SDK, and now the android command is depricated.
but I did this instead and it seems to work, as I build a kodi version that I am running on my Philips TV.

$ cd /$HOME/android-sdk-linux/Tools/bin

$./sdkmanager "platforms;android-25"
$./sdkmanager "platforms;android-21"
$./sdkmanager "platform-tools"
$./sdkmanagar "build-tools;25.0.3"

perhaps the install/update of android-25 is not necessary
Reply
#15
Yeah i habe this in the queue already

https://github.com/Memphiz/xbmc/commit/4...7f64968481
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply

Logout Mark Read Team Forum Stats Members Help
[Android Krypton Compile Guide] Step by Step3