# [SCRIPT][WIP] Android Build Environment and Source Sync-v0.1-Ubuntu 13.04



## Adam80460 (Jun 7, 2011)

*Download*​
This is a simple script that will setup an Android build environment and sync some of the most popular android sources. This as of now will not build the sources but, that will be coming soon. There are other scripts out there that have more options, but this will get the job done. Just wanted to share 

*What this script will do is: *


Install oracle java6 & purge openjdk
Setup adb and fastboot
install packages needed to build
sync Amdroid source
this has only been tested on Ubuntu 13.04

*Android Source Options: *

1) XenonHD
2) Aokp
3) Cyanogenmod 10.1
4) Carbon
5) Root-Box
6) Paranoid Android

*Directions:*

Extract zip to Home directory

unzip android_setup.zip

change to android_setup directory

cd android_setup/

run script

source geterdone.sh


----------



## yarly (Jun 22, 2011)

Just a suggestion, I think it would be more friendly to leave openjdk7 installed (as some people have a good reason for having Java 7 on their PC [as in they use it for things related to Java 7]). You can do that by updating the alternatives, which lets you specify which is the default. I think Android also ignores versions of 7 installed if you have a version of 6 installed as well (whether default or not) so you really don't have to remove 7 as long as 6 is there. 7 does have a lot of bug fixes, security fixes and performance increases that 6 does not have and there's software on operating systems that will benefit from it.

http://wiki.debian.org/Java/Sun

See the link above for how to do that.

Also, might want to add all that initialization stuff you have to a function and then call it only once if it runs okay for the user so if they run that script again, it won't go through all the steps once again.

You can also replace all those echo lines like these:

```
<br />
sudo apt-get update && sudo apt-get install oracle-java6-installer -y<br />
echo ""<br />
echo ""<br />
echo ""<br />
java -version<br />
echo ""<br />
echo ""<br />
echo ""<br />
echo ""<br />
echo ""<br />
echo "Done"<br />
echo ""<br />
echo ""<br />
echo "**************************************************************************"<br />
```
with this (note the -e on echo):


```
<br />
sudo apt-get update && sudo apt-get install oracle-java6-installer -y<br />
echo -e "\n\n\n"<br />
java -version<br />
echo -e "\n\n\n\n\n"<br />
echo "Done"<br />
echo -e "\n\n"<br />
echo "**************************************************************************"<br />
```
Just semantically nitpicking so this is more optional, but you could replace the conditionals at the bottom with a case/switch, since they're nice for menu areas (http://stackoverflow...witch-case-bash for reference)

Good job though and I'm sure a lot of people will find your work useful


----------



## Adam80460 (Jun 7, 2011)

Thanks yarly for your feedback. I'm actually trying to teach myself how to script properly and I will apply your suggestions in the next update.

Sent from my SCH-I535


----------



## yarly (Jun 22, 2011)

No problem. Intellij IDEA has a nice bash plugin if you're just learning bash in order to eliminate a lot of beginner mistakes (syntax stuff and code completion). Might want to check it out as it's a free (third party) plugin that works with the community version. It's in their plugin repository in the IDE.


----------



## tommy0823 (Nov 6, 2011)

I peersonally am very glad that you kept jdk ^. I recently have started to play around with building, and have had some issues getting 7 to play nice with the build environment. this scriptworked EXACTLY as it should in installing the correct version of java so that i can build on my machine. Thank you for the time you took to do this. I haven't seen many help threads for 13.04 yet. This script makes setting up your environment so much easier. Thank you


----------

