# Android development on FreeBSD



## karel (Nov 9, 2012)

Hello people! I'm interested in Android development on FreeBSD, but didn't make much progress so far. Android SDK for Linux doesn't even install properly and I can't get VirtualBox on FreeBSD 9/amd64 to attach USB devices.

I'd be very glad if you would be willing to share your experiences and success stories.

Thanks,
Karel Miklav


----------



## kpedersen (Nov 9, 2012)

Hello karel,

You might like to try with wine. I generally use that rather than the linux compatibility stuff since it is more encapsulated.

Don't bother with the android-sdk adb driver stuff since that wont work, but instead set up a simple httpd server (I use mongoose httpd) to download the built package on a physical android device. I write OpenGL software for android so the sdk provided emulator is useless anyway.

I don't use the eclipse stuff or the ant build system, instead I use a simple Makefile system so it also works with our bamboo continuous integration well, so I highly recommend you do the same.

So in general, Android development for FreeBSD is very possible. If you want a real challenge, try iOS 

I havn't tried it but for a native solution, there is also bsdroid.org


----------



## marwis (Nov 9, 2012)

karel said:
			
		

> I can't get VirtualBox on FreeBSD 9/amd64 to attach USB devices.


I do use emulators/virtualbox with USB support on FreeBSD 9 on amd64 platform. Just follow the instructions after installing the port.  There's also the Virtualbox USB Support chapter in the Handbook.


----------



## karel (Nov 9, 2012)

Hi kpedersen and thank you, this is great news. I'll try to follow your trail. Could you please show me an Android Makefile example?


----------



## karel (Nov 10, 2012)

marwis: which hosts do you have? I got USB working in Windows XP, but none of the Linuxes; Mint, Fedora, Debian, all amd64.


----------



## marwis (Nov 10, 2012)

Good point!  I got it working on Windows XP guest.  I haven't tried my other guest systems.


----------



## kpedersen (Nov 12, 2012)

Sure, I have attached a very simple project (modified from one of the samples).

This example does not generate an R.java since I find that process really hacky, instead it uses res/ just for the icon, but then uses assets/ for the rest of the raw assets which can then be loaded / read as normal. You can see how this is done in the first rule in the Makefile.

I have also included a ./build script in the tarball which can be removed but it just provides a sequential list of commands to generate a package.


----------



## karel (Nov 12, 2012)

Thank you Karsten! I've got everything configured now and your build system is just great.

I do Android development in VirtualBox hosted GNU/Linux and copy APKs to a real device via HTTP. If VirtualBox USB stack starts working someday I'll be fully set. This is hardly a native solution, but I'm glad I didn't have to replace my host operating system.


----------



## kpedersen (Nov 13, 2012)

Hi karel,

No problem, I am glad you find it useful 

Much of the build system is based on this blog: http://asantoso.wordpress.com/2009/...s-continuously-integrated-using-cruisecontrol
(This also does that R.java stuff that I left out)

Yeah, I would personally stick to transfer via http because I am 99% sure that future android devices will be even more locked down and the usb adb stuff will probably become unsupported.

Interestingly, almost all of the required tools to do this can be ran from the android device itself using TerminalIDE (http://code.google.com/p/terminal-ide/), so it should be possible to ssh / telnet into the device and do the actual build on it.

I am currently working on getting the NDK working using Makefiles too.


----------



## karel (Nov 28, 2012)

Running the Android development tools in virtual environment has its ups and downs, but that's not the end of the virtual rush. You can install a virtual Android like AndroVM in VirtualBox and then connect both systems with adb:


```
adb connect 192.168.56.101
```


----------



## rayit (Jan 21, 2017)

adb is working fine!

Only if I use build (kpederson download zip) or ant debug I get following error:
./android/build-tools/25.0.2/aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory

I have got linux-c6 port installed
Somebody knows a solution?

many thanks
Raymond


----------



## escape (Apr 6, 2017)

I found these instructions to install adb you propably do not need anymore: http://tiggeron.blogspot.fi/2014/01/freebsd-android-development-success.html
http://tiggeron.blogspot.fi/2014/01/freebsd-android-development-success.html
Adb works. I've installed APK:s, not developed at all. How to give root permissions to a firewall application?

escape


----------

