"Best" Android Development Environment Versions (ubuntu, NDK, JDK, JRE, etc)
#1
Hi all,

I want to setup an Android development environment to start trying to get our PVR addon (pvr.wmc) supporting Android, which is one of the most requested features from our user base. Nobody with XBMC android experience has come along our doorstep so I figured it's time to try and get things happening for myself!

Before I started, I just wanted to clarify the recomendations for dev environment, toolchain etc.

The README states the following info
Code:
We currently recommend Ubuntu Natty (11.04) or later. Current work has been
done here. Additionally, building from OSX Snow Leopard is working.


[NOTICE] Compiling XBMC for Android requires at least Android NDK
         Revision r8e. Android NDK Revision 7 and earlier do not work
         properly for our cause.

Make sure you have a recent JRE and JDK installed otherwise the
Android SDK will not work.

However given this information is from a while ago and there are now newer versions than those stated, Im not sure what the best approach is. It says "at least" ubuntu 11.04 or later, and "at least NDK r8e", which implies that it's totally fine to use newer versions... But on the NDK front I found a thread on here from a few months ago where someone was having a problem, and the devs said they should be using NDK r8e rather than NDK 9. So when the readme says "at least xxxx" but people run into problems and are directed back to older versions, it's hard to know what to start with.

For example regarding using a "recent" JRE and JDK version, is that recent in the context of the timeframe that ubuntu 11.04 was "current" or is that recent as in the very most recent release?

I want to start with the best setup and I have no other goals or requirements from this system than to develop/compile XBMC and the xbmc_pvr_addons project for Android, so Im not concerned about needing any other apps to run or certain hardware support or anything like that.

It would be great if someone could post the exact Ubuntu, NDK, JRE and JDK versions I should be using? Even if someone can just list the versions of everything they are using that is working/compiling OK, I will just copy that!

Many thanks! Smile
pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
Reply
#2
Sure would be great!
Reply
#3
Who stated not to use NDK r9? I would just use what our buildbots use atm.

NDK r9 - and gcc 4.8 as a toolchain (this is important!). We don't have any info on current jdk/jre/sdk versions so we don't state anyhing about. Also we are not running after each update and testing if it still compiles. Maybe i just should change the readme to those definit versions so nobody tries something we might not have tried yet.
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
#4
Remember to build for both Android-ARM and for Android-X86 targets to support all platforms

(2013-12-10, 06:21)scarecrow420 Wrote: But on the NDK front I found a thread on here from a few months ago where someone was having a problem, and the devs said they should be using NDK r8e rather than NDK 9. So when the readme says "at least xxxx" but people run into problems and are directed back to older versions, it's hard to know what to start with.
NDK r9 should work fine, see http://forum.xbmc.org/showthread.php?tid=177292

Maybe ask what Team-XBMC uses for Jenkins http://xbmc.org/jenkins-servers-and-mirrrors/

http://wiki.xbmc.org/index.php?title=Jenkins
Reply
#5
Hey Memphiz,

Funnily enough it was actually you who stated "we recomend NDK r8e not 9" if you refer here ;P http://forum.xbmc.org/showthread.php?tid=170362
But like i say this is from a few months ago so it seems it's probably now OK to use NDK 9 and GCC 4.8

When you say you dont have any info on current jdk/jre/sdk versions so dont state anything about it... im still left confused as to what I should be getting!

I want to setup a brand new Ubuntu VM environment to do this development and I just want to know what exact versions of everything to grab. Perhaps you can tell me what you are currently using (which presumably works) and I will just use that! I am a windows developer, and really only play enough with some linux boxes, NAS and raspberry pi to be classified as "dangerous" lol Smile I also have rooted and played around with various android phones for years... but I am still just a bit green on the XBMC android development front. I can certainly follow instructions and wont come on here to ask for help until ive googled the heck out of my problem first etc, however I just can't find any instructions that tell me where to start. I am still stuck at the first step - what version of Ubuntu to get (eg do i go with the mentioned 11.04 eventhough it is several releases old or should i go for the most recent).

Can anyone post what versions of the following they are using successfully, and I will just follow suit!?

Ubunutu
NDK (from above, V9 is confirmed)
GCC (from above, 4.8 is confirmed)
SDK
JRE
JDK


It would be pretty cool and infinitely more accessible to developers, if there was a downloadable virtual machine that was already setup as an XBMC android build box! If I manage to get something working I will certainly try and figure out how to create an image/OVF and share it for others!
pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
Reply
#6
For the love of god, use the source Luke. It's always up to date ...

https://github.com/xbmc/xbmc/blob/master...ME.android
https://github.com/xbmc/xbmc/blob/master...nds/README

Smile
Reply
#7
Davilla, Im afraif that has just further added to my confusion.

Code:
./configure --with-toolchain=/opt/toolchains/android-ndk-r7-crystax-5.beta3-toolchain-14 --prefix=/opt/xbmc-deps --host=arm-linux-androideabi --with-sdk-path=/opt/android-sdk --with-ndk=/opt/android-ndk-r7-crystax-5.beta3 --with-sdk=android-14 --with-tarballs=/tmp/xbmc-android

it seems to say "ndk-r7" but I thought we were saying in here that it was r8e in the past, but r9 should now be OK too? That file shows it was last modified 9 months ago so it seems even older than the forum discussions ive alreayd highlighted? It also doesnt help confirm what version of ubuntu OS i should start from, what JRE/JDK etc?

Have I done something wrong asking for setup guidance here in the Android forum? Surely the idea of open source community spirit is not to make new devs figure everything out for themselves each time? Im just asking for a list of the versions of the above components/prerequisites to create a "working build environment" rather than having to go through trial and error and unnecessary troubleshooting
pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
Reply
#8
*sigh* ... i am preparing a spoon soon *rime* ...

Nobody kept those readmes up to date i fear. So i will try to correct this.

Ohhh and of course citing me from some month ago doesn't help. At that point my statement was correct for sure.
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
#9
readmes updated...
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
#10
Yum yum, spoon tastes good.

Thanks Memphiz, looks like a thorough update and gives me (and others) much needed recent info/clarification to get started. I'll work through it today , hopefully the only further post from me will be that everything is up and running Smile
pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
Reply
#11
the next post from you will be that make apk doesn't work because "aapt" can't be found. I bet a beer on that...
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
#12
Hi Memphiz,

I guess you owe me a beer hehe Smile Thanks to your updated info, I have managed to setup an ubuntu build box and succesfully building XBMC (x86) and our pvr addons (xx86 and arm). I do have an issue with XBMC arm architecture build, which I am still looking into... But i solved the aapt issue myself, so I don't owe you a beer :p

Thankyou very much for the info provided so far

One question i have - I found I need to use "sudo" on a lot of commands, because the suggested /opt/ directory is permission 755 (ie only writable by root). So anything that writes data there, such as installing the NDK and SDK, creating the toolchains, getting the building the XBMC dependencies/tarballs etc need to run under sudo. The actual make doesnt, but make apk does (because it copies stuff to xbmc dependencies). Ive seen other posts on here about "not drinking from the sudo chalice" and tainting the build tree, but being a relatively inexperienced linux user, I wasnt sure what to do... should I chmod -R /opt/ to be 777?! That seems bad (as bad as using sudo). So far I am just sudo on anything that fails due to permissions in /opt/ but running whatever I can without it. Consequently some steps in the readme that dont have sudo on them, I had to sudo?

Anyway here are my notes of things that were incorrect/missing from the readme... im not sure if all off these (particularly the toolchain one) are corrections to the readme, or are specific only to my situation...

OS: ubuntu-server-12.04-amd64
Android SDK: android-sdk_r22.3-linux.tgz
Android NDK: android-ndk-r9-linux-x86_64.tar.bz2

Followed the instructions in the readme. Used all suggested paths for SDK NDK and toolchains (/opt/android-sdk-linux/ etc) in the readme.

- There is a typo in the java section for the jre package name (it should be openjdk-6-jre rather than openjre-6-jre)
Quote:The following versions are used on our continuous integration system "jenkins". Other (newer)
versions might work as well.

JDK: openjdk-6-jdk (java version "1.6.0_27")
JRE: openjdk-6-jre (java version "1.6.0_27")

- Make dependencies was failing with a missing component "nasm" which was easy to apt-get, not sure if this is my setup or everyone would encounter it. nasm could be included in the apt-get command in the readme
Quote:sudo apt-get install build-essential default-jdk git curl autoconf unzip zip zlib1g-dev gawk gperf cmake nasm

- Creating the arm toolset was failing for me, until i added a --system=linux-x86_64 (was this OK to do?)
Quote:sudo ./make-standalone-toolchain.sh --ndk-dir=../../ \
--install-dir=/opt/arm-linux-androideabi-4.8-vanilla/android-14 --platform=android-14 \
--toolchain=arm-linux-androideabi-4.8 --system=linux-x86_64

- Git submodule command fails "fatal not a valid repositopry". Didnt seem to have any bearing on the build process though?
Quote:# cd $HOME
# git clone git://github.com/xbmc/xbmc.git xbmc-android
# cd xbmc-android
# git submodule update --init addons/skin.touched <-- this command fails, is it still valid?

- The aapt could not be found is due to the later android SDK appearing to have split the build-tools out into a separate component, so in the "android update sdk" step, we need to specify the build-tools in the filter (-t argument) in addition to platform and platform-tools. Problem is you need to specify the full name of the build tools including their version number (currently build-tools-19.0.0). You can determine this by running "./android list sdk --extended" and seeing the full name of the build-tools that are current. It appears to have an ID as well so perhaps that is better, but now ive installed them they dont show up in the list anymore so im not sure what a repeatable "works for everyone and any version" command would be, so I have just listed the command as it works today on the current SDK version and build-tools-19.0.0.

Finally. the XBMC make process assumes the aapt and dx executables are located in the SDK platform-tools directory (as Im assuming they used to be) but they now live under a versioned build-tools directory (if it's empty it's because you need to specify it as filter on the update sdk step above). For now, we can just create symlinks in platform-tools, pointing to their actual location in the build-tools area. It seems like the libs folder is also required. Im assuming that the XBMC make could be enhanced to locate these itself or simply updated to the new structure as per the later SDK's and update the prerequisites to state the minimum android SDK required as a current version with the build-tools sub directory?
Quote:After having extracted the Android SDK to <android-sdk> you need to
install some android packages using the Android SDK Manager:

# cd <android-sdk>/tools
# ./android update sdk -u -t platform,platform-tool,build-tools-19.0.0
# sudo ln -s /opt/android-sdk-linux/build-tools/19.0.0/aapt /opt/android-sdk-linux/platform-tools/aapt
# sudo ln -s /opt/android-sdk-linux/build-tools/19.0.0/dx /opt/android-sdk-linux/platform-tools/dx
# sudo ln -s /opt/android-sdk-linux/build-tools/19.0.0/lib /opt/android-sdk-linux/platform-tools/lib

At this point I was able to perform everything all the way up to "make apk" for an x86 architecture and it worked great. I also pulled down xbmc_pvr_addons from github and was able to build both x86 and arm configurations. I am now just trying to nut out a compile error I am getting on XBMC make step, for arm architecture. It may be related to me having to modify the arm toolchain command as per one of my above notes... but it wouldnt work without that --system argument. Still digging...

Again, thanks for the information so far. Hopefully you can see that I am not just wanting to be spoon fed and am trying to figure things out for myself and providing information that may help others in the same situation Smile
pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
Reply
#13
Well thats the problem with devs which are not familiar with unix. Of course the default location of /opt/ is silly. But for getting this right i would need to change all those locations to something like /home/<yourusername>/android-dev or so. And i was really just to tired to explain what /home/<yourusername> means and stuff.

Sorry but this whole readme is not really ment to be followed by unexperienced people. This is the case for all platforms. And maintaining the README in a way that it would be self descriptive enough to be followed by users (i know you are not a user ... just as an example here) is just really time demanding task.

I know we are lacking behind with our readmes most of the time. Feel free to adapt the README in a way you think it fits and hand me a patch (yeah thats the sentence nobody wants to here - i know).

PS: for the opt dir i would have created a subdir "android-dev" which i would have chown'ed to the user i am building under - and then point anything to that subdir. Doing this would prevent the need of sudo.
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
#14
(2013-12-17, 12:56)Memphiz Wrote: Well thats the problem with devs which are not familiar with unix. Of course the default location of /opt/ is silly. But for getting this right i would need to change all those locations to something like /home/<yourusername>/android-dev or so. And i was really just to tired to explain what /home/<yourusername> means and stuff.

Sorry but this whole readme is not really ment to be followed by unexperienced people. This is the case for all platforms. And maintaining the README in a way that it would be self descriptive enough to be followed by users (i know you are not a user ... just as an example here) is just really time demanding task.

I know we are lacking behind with our readmes most of the time. Feel free to adapt the README in a way you think it fits and hand me a patch (yeah thats the sentence nobody wants to here - i know).

PS: for the opt dir i would have created a subdir "android-dev" which i would have chown'ed to the user i am building under - and then point anything to that subdir. Doing this would prevent the need of sudo.
Im happy to send a pull request through for the readme... It's 99% there anyway now after your updates. My main concern was whether what I have highlighted are correct additions/corrections or whether something is wrong with my setup. Eg is the --system addition to the arm toolchain correct? What about that invalid git submodule, should it just be removed from readme? regarding the build-tools is there a better way to install them without needing to do a list --extended to get the full version number name

subdir under opt sounds good, I will build another machine with that approach.

Unfortunately I am still stumped on the arm build issue. Ive setup a 2nd VM from scratch and run into the same compile problem. Thought it might be a recent commit so I did a git checkout of a reasonable while ago but get the same problem. Meanwhile jenkins build system is building the latest OK it seems, so I do think it's something with my (2) setups now unfortunately...

This is the error i get on the "make" step for xbmc under arm architecture. The bootstrap, configure and make step in the /tools/depends directory, plus the make -C tools/depends/target/xbmc in the xbmc-android directory all succeeded prior to this with no errors output... but the actual xbmc make gets this:
Code:
LD      libxbmc.so
/opt/arm-linux-androideabi-4.8-vanilla/android-14/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: xbmc/cores/DllLoader                     /exports/exports.a(emu_dummy.o): incompatible target
emu_msvcrt.cpp:332: error: undefined reference to 'not_implement'
emu_msvcrt.cpp:337: error: undefined reference to 'not_implement'
emu_msvcrt.cpp:374: error: undefined reference to 'not_implement'
emu_msvcrt.cpp:442: error: undefined reference to 'not_implement'
collect2: error: ld returned 1 exit status
make: *** [libxbmc.so] Error 1

As I said, x86 is working ok, arm is getting the above error. If anyone has any suggestions please let me know!
pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
Reply
#15
1. the git submodule command is correct and should work. How does it fail? (ensure that you do this command in the xbmc directory!)
2. I have no clue about the --system command line - can't remember when i did the setup on the jenkins slave
3. for the compile errror - ensure that you use a different build directory for x86 and arm. If you did use the same it might be that it is polluted with x86 binaries somehow. (git clean -xfd would clean it so that gets the state after checkout by removing all generated files/objects)
4. installing nasm is fine and was missing in the readme because we added x86 support some month ago (pretty new stuff...)
5. The thing with the --extended flag i just didn't get. Maybe you can reformulate the problem and on which part of the readme it occurs.
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
"Best" Android Development Environment Versions (ubuntu, NDK, JDK, JRE, etc)0