New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Tip us?
 
phidelt82
Old
#1  
phidelt82's Avatar
Recognized Developer - OP
Thanks Meter 390
Posts: 753
Join Date: Aug 2008
Cool [GUIDE] How to set up a basic Android Dev Environment

Since I have gotten several requests to show people how to set up a dev environment, I thought I would write up a how to guide and just post it in a thread.I have had to set up a new dev environment a few times now, and each time I've had to look the information up piece by piece. All of the guides that I have found are out of date or don't work for what I want to accomplish, which is build a basic environment that I can decompress nandroid backup images in, build kernels, compile images, and just be ready for anything that is thrown my way that needs a Linux based setup to look at or test.

And just because I probably need to put this in here,

********I AM NOT RESPONSIBLE FOR ANY HARM THAT MAY COME TO YOUR COMPUTER, PHONE, OR ANYTHING ELSE THAT YOU MAY USE WHILE READING OR TRYING TO IMPLEMENT ANY OR ALL PARTS OF THIS GUIDE.*********


Guide Tips:
Read everything first. Then go to the websites listed and read it again. This will give you somewhat of an understanding of what you are going to be doing. This is what I use and it works for what I do. I do not use Eclipse, therefore I did not include it in this guide. While reading this guide, Linux and Ubuntu are one in the same so don’t get confused by terminology. Ubuntu is just a flavor of Linux. You may prefer a different flavor and that is fine. While working in Terminal, if I put something in italics, don’t type that part. Italics are meant as an extra bit of info. If the text went to a new line and there is a space before the next line starts, hit enter. If the text went to a new line and there is no space, it’s the same line of code.


Downloads:
Download Ubuntu 10.10 32-bit desktop edition from: http://www.ubuntu.com/desktop/get-ubuntu/download
Download and install VirtualBox from: http://www.virtualbox.org/wiki/Downloads
Install Ubuntu 10.10 on the VirtualBox like this: http://www.psychocats.net/ubuntu/virtualbox


VirtualBox Tips:
Use a 50GB (or bigger) Hard Drive size if you can afford the space.
Pick an easy password and log on automatically. This will make things easier later.
When you get set up, go to System, Settings, Screensaver, and uncheck Activate screensaver when computer is idle, and Lock screen when screensaver is active. It is not necessary on a VirtualBox anyway and will just become an annoyance.
I recommend downloading and installing the VirtualBox Guest Additions for Linux by clicking Devices, Install Guest Additions. This will make things easier if you need to resize your Linux desktop window, or cut and paste text from Windows to Linux.
If you need to move files easily from Windows to Linux, put them on a USB drive in Windows. Then in on the VirtualBox, click Devices, select USB Devices, find the USB drive that you are using and select it. The drive will then be accessible in Linux. To move something back to Windows, just uncheck the drive in the same manner. There is a common share folder you can set up, but I find it more of a hassle than just using a USB drive.


Inside Ubuntu:
Download and save the Android SDK for linux from: http://developer.android.com/sdk/index.html
Download and save unyaffs from: http://code.google.com/p/unyaffs/downloads/list


Go to Applications, Accessories, and Select Terminal

In Terminal type:


Go to Applications, Accessories, and Select Terminal

In Terminal type:

sudo passwd (it will ask you for a new password, just enter the password you used in setup)
(retype the same password)


mkdir ~/android

cd Downloads

sudo mv unyaffs /bin

tar –zxvf android-sdk_r08-linux_86.tgz

mv android-sdk-linux_86 ~/android

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

sudo apt-get update

sudo apt-get install sun-java6-jdk

sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

mkdir ~/bin

curl http://android.git.kernel.org/repo > ~/bin/repo

chmod a+x ~/bin/repo

cd ~/bin

sudo mv repo /bin

cd /bin

chmod 777 unyaffs

cd ~/android/android-sdk-linux_86/tools

. android (notice the period and space before “android”, this is a "run" command, the Android SDK and AVD Manager will open)
Select as many or as few packages from the available packages as you want. You need to have Android SDK Tools, revision 8, which should already be installed, and Android SDK Platform-tools, revision 1 at a minimum. Press Install Selected when you are ready. When finished, close the Manager.




Closing Notes:
At this point you will have the tools to decompress a nandroid backup image and work with those files to create a basic ROM, download repos, download source code from github, and be able to do other things that are used to develop for Android phones. This is by no means all inclusive. It is just a basic setup to get you ready to do some of the things possible. If people find this useful, I may write other guides to explain how to do other things, so give me feedback.
Come see us on irc #samsung-mesmerize if you have a question or just want to hang out.
The easy way-->http://webchat.freenode.net

Check me out on Twitter @phidelt82 or Google+

Currently running:
HTC Thunderbolt
BAMF Stripped v1.8

Retired:
Mesmerize - Still building for it, don't worry.
EE19 build
PnP v1
NoClock mod
The Following 7 Users Say Thank You to phidelt82 For This Useful Post: [ Click to Expand ]
 
Sighcosis
Old
#2  
Sighcosis's Avatar
Member
Thanks Meter 11
Posts: 92
Join Date: Apr 2009
Location: Monroe

 
DONATE TO ME
I was going to ask you if you could do a step by step. I jade downloaded all the stuff was having a few issues getting going.
THANKS.

Sent from my SCH-I500 using XDA App
"Nothing that is worth knowing can be taught."- Oscar Wilde

“We learn more by looking for the answer to a question and not finding it than we do from learning the answer itself.”- Lloyd Alexander
 
Sighcosis
Old
#3  
Sighcosis's Avatar
Member
Thanks Meter 11
Posts: 92
Join Date: Apr 2009
Location: Monroe

 
DONATE TO ME
All systems go.. LOL awaiting further instructions.

and again .. Thanks..
"Nothing that is worth knowing can be taught."- Oscar Wilde

“We learn more by looking for the answer to a question and not finding it than we do from learning the answer itself.”- Lloyd Alexander
 
Sophos1
Old
#4  
Sophos1's Avatar
Senior Member
Thanks Meter 5
Posts: 131
Join Date: Aug 2008
Location: Medford, OR
Wow, this is great....i will be setting this up as soon as i have a couple of hours to spare.
Thx

Sent from my SCH-I500 using Tapatalk
 
dcow90
Old
(Last edited by dcow90; 8th January 2011 at 07:54 AM.)
#5  
dcow90's Avatar
Recognized Developer
Thanks Meter 37
Posts: 153
Join Date: Aug 2009
Location: Grinnell, Iowa

 
DONATE TO ME
Default Some extra info..

Some other nice sites to mention if you're truley interested in getting into building your own ROMs and not just porting (but certainly porting as well) might be:

Samsung Open Source Release Center:
http://opensource.samsung.com/index.jsp

From the Samsung OSRC you can get the source files to compile the Linux kernel for the Samsung Mezmerize. You will have to sign up for an account (free) and the download speeds are throttled but whatever.. it's the source files right from the manufacturer.

After you learn how to compile the kernel from Samsung source, you might take a stab at compiling the Voodoo v5 lagfix kernel for the mezmerize yourself.

Project Voodoo:
http://project-voodoo.org/

Project Voodoo has some very nice documentation and their own IRC channel on freenode #project-voodoo if you have any questions. After you work through compiling a modified kernel, you should be on your way to working on building your own roms and possibly helping with development and porting work for the 2.2 and 2.3 versions of the Android Open Source Project.

Most of these efforts can be found on github using their nice search. Or, look at the 2.1[Alpha] ROM thread for links to the fascinate source:
http://forum.xda-developers.com/showthread.php?t=898231

On that note, GET FAMILIAR USING GIT. You should already have git on your linux distro if you followed the instructions above (or if you've ever issued a sudo apt-get install git command). git has a very nice tutorial and extensive man documentation which can be accessed using:
man 7 gittutorial
Why? Because:
http://android.git.kernel.org/
and:
http://source.android.com/source/git-repo.html

I hope this extra info helps. And for some positive reinforcement.. building a kernel and subsequently rom is not that difficult (assuming you're knowledgeable in Computer Science and have some enthusiasm for a project like this.. for someone without prior knowledge it's a different issue..). But it is a BIG task. With that in mind, it just requires a lot of persistance and A LOT of reading, checking, and double checking. If you're willing to take the time to read others' documentation and build upon what they've done you can do a lot!

Some further reading that may interest you:
What is Android?
http://developer.android.com/guide/b...s-android.html
Dalvik Virtual Machine
http://sites.google.com/site/io/dalvik-vm-internals
http://www.usenix.org/events/vee05/f...p153-yunhe.pdf
Odex? Deodex?
http://android.git.kernel.org/?p=pla...t.html;hb=HEAD
^^great article read it!!
decompiling and recompiling the .odex class
http://code.google.com/p/smali/
 
droidroidz
Old
#6  
Senior Member
Thanks Meter 13
Posts: 110
Join Date: Dec 2010
Excellent info, thanks for this!
 
dcow90
Old
#7  
dcow90's Avatar
Recognized Developer
Thanks Meter 37
Posts: 153
Join Date: Aug 2009
Location: Grinnell, Iowa

 
DONATE TO ME
This is good too:
http://www.cmsgs.com/mediawiki/index...sung_Fascinate
 
droidzach
Old
#8  
droidzach's Avatar
Senior Member
Thanks Meter 21
Posts: 169
Join Date: Dec 2010
Location: Monroe, WI
Sweet I'm gonna add this to my Mac and get on the path to actual development, not just flashing stuff. I'm glad to see that virtual box runs on OSX I was just gonna use this as another excuse to add another OS and make my wife even happier... Thanks for all the info guys, and any more guides that you find the time for would be appreciated greatly! I got lots of reading to do now, and now I have something to do besides scrape snow off my car.
 
dcow90
Old
#9  
dcow90's Avatar
Recognized Developer
Thanks Meter 37
Posts: 153
Join Date: Aug 2009
Location: Grinnell, Iowa

 
DONATE TO ME
Quote:
Originally Posted by droidzach View Post
Sweet I'm gonna add this to my Mac and get on the path to actual development, not just flashing stuff. I'm glad to see that virtual box runs on OSX I was just gonna use this as another excuse to add another OS and make my wife even happier... Thanks for all the info guys, and any more guides that you find the time for would be appreciated greatly! I got lots of reading to do now, and now I have something to do besides scrape snow off my car.
Feel free to ask us any specific questions you may have. You can find us in #samsung-mesmerize on freenode.net irc.
> ::
> :: If you appreciate my work:
> :: --- help me pay for textbooks..
> :: --- --- or buy me a beer.. d=
> :: --- --- --- either way I will be grateful. (=

Follow me on Twitter | dcow90
My source on github | dcow
Chat irc.freenode.net | #samsung-mesmerize
 
bdemartino
Old
#10  
bdemartino's Avatar
Senior Member
Thanks Meter 184
Posts: 838
Join Date: Jan 2011
Location: Midwest

 
DONATE TO ME
Bump, this should be stickied.


Scotsman, Are you receiving all of our pm's? I sent a few today, not sure if you've had a chance to read them but someone else thought the same so I wonder if the forum is having issues sending them to you?


XDA PORTAL POSTS

Voice Control Your Phone with Tasker and AutoVoice – XDA Developer TV

XDA Developer TV Producer Kevin set up his phone to respond to … more

Guide to Take Better Control of Your Volume Levels

Would you like to know one of the things that really annoys me on a daily basis? Tough, … more

Get the Android 4.2.2 Status Bar on Your Gingerbread-Based Samsung

There are still quite a few of folks who run Gingerbread on their … more

Responses From Ubuntu Pouring Into Ubuntu Touch Q&A Thread

Ubuntu has become the most successful *nix distribution for a number of reasons, … more