rss

Artictles

Hi, thanks for visiting this page. Here I write about technology, in-depth analysis of some problems, sport management, among others. If you like these things, you will be glad to read the articles. Also, you can comment or ask questions whenever you want. I will try to respond as soon as possible...

Android development environment Bookmark

To build Android you will need a special development environment. Sometimes this could have special requirements. Below I describe how to create a virtual environment with the following properties:

  • Host machine
  • VirtualBox
  • Ubuntu 14.04 64 bits
  • Build tools
  • Optional tasks

Android development environment

This document contains information from a wide variety of sources and authors, you are encouraged to consult these sources or the comments/questions section for more information before asking new questions.

Host Machine

The host computer used to create the virtual machine have the properties (please, view the following).

Host machine

Virtual Machine

The option selected is VirtualBox with 100GB in space in hard disk. You can download here. Other hardware options are show in the picture below.

Virtual Machine properties

A that time the version used was VirtualBox 4.3.10 under Windows (see picture below).

VirtualBox version

Ubuntu 14.04 LTS 64 bits

According with Android Open Source Project (AOSP) newer versions, including the master branch, a 64-bit environment is required. In this case I suggest to install Ubuntu 14.04 from here.

Once the OS system is installed you can check the version (as picture below).

image

Java 6

The master branch of Android requires Java 7. On Ubuntu, AOSP suggest to use OpenJDK. To install this in your environment use the following commands:

   1: sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\* 
   2: sudo add-apt-repository ppa:webupd8team/java 
   3: sudo apt-get update && sudo apt-get install oracle-java6-installer 
   4: java -version

The last command shows the Java version installed (see picture).

Build tools

Usually building workspace with android application takes too long. You need to take care of all the build tools to reduce the errors in the build process. Below the required packages and tools according with AOSP.

Packages

Below the script to install the required packages:

   1: sudo apt-get install git 
   2: sudo apt-get install gnupg 
   3: sudo apt-get install ccache 
   4: sudo apt-get install lzop 
   5: sudo apt-get install flex 
   6: sudo apt-get install bison 
   7: sudo apt-get install gperf 
   8: sudo apt-get install build-essential 
   9: sudo apt-get install zip 
  10: sudo apt-get install curl 
  11: sudo apt-get install zlib1g-dev 
  12: sudo apt-get install zlib1g-dev:i386 
  13: sudo apt-get install libc6-dev 
  14: sudo apt-get install lib32bz2-1.0 
  15: sudo apt-get install lib32ncurses5-dev 
  16: sudo apt-get install x11proto-core-dev 
  17: sudo apt-get install libx11-dev:i386 
  18: sudo apt-get install libreadline6-dev:i386 
  19: sudo apt-get install lib32z1-dev 
  20: sudo apt-get install libgl1-mesa-glx:i386 
  21: sudo apt-get install libgl1-mesa-dev 
  22: sudo apt-get install g++-multilib 
  23: sudo apt-get install mingw32 
  24: sudo apt-get install tofrodos 
  25: sudo apt-get install python-markdown 
  26: sudo apt-get install libxml2-utils 
  27: sudo apt-get install xsltproc 
  28: sudo apt-get install libreadline6-dev 
  29: sudo apt-get install lib32readline-gplv2-dev 
  30: sudo apt-get install libncurses5-dev 
  31: sudo apt-get install bzip2 
  32: sudo apt-get install libbz2-dev 
  33: sudo apt-get install libbz2-1.0 
  34: sudo apt-get install libghc-bzlib-dev 
  35: sudo apt-get install lib32bz2-dev 
  36: sudo apt-get install squashfs-tools 
  37: sudo apt-get install pngcrush 
  38: sudo apt-get install schedtool 
  39: sudo apt-get install dpkg-dev
  40: sudo apt-get install u-boot-tools
  41: sudo apt-get install uuid-dev:i386
  42: sudo apt-get install liblzo2-2 liblzo2-dev:i386
  43: sudo apt-get install liblz-dev
  44: sudo apt-get install libswitch-perl
  45: sudo apt-get install vim
  46: sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Java 6

The master branch of Android requires Java 7. On Ubuntu, AOSP suggest to use OpenJDK. To install this in your environment use the following commands:

   1: sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\* 
   2: sudo add-apt-repository ppa:webupd8team/java 
   3: sudo apt-get update && sudo apt-get install oracle-java6-installer 
   4: java -version

  The last command shows the Java version installed (see picture).

Java version

Repo tool

Repo is a repository management tool that Google built on top of Git. Repo unifies the many Git repositories when necessary and automates parts of the Android development workflow.

   1: cd /home/android/
   2: mkdir -p wandboard/myandroid
   3: cd wandboard/myandroid
   4: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ./repo 
   5: chmod a+x ./repo 

Cross compiler tools for ARM

Below the commands for install the cross compiler tools for ARM processors:

   1: mkdir -p /tmp/sourcery
   2: cd /tmp/sourcery
   3: wget http://www.codesourcery.com/sgpp/lite/arm/portal/package7813/public/arm-none-eabi/arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
   4: bunzip2 arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
   5: tar -xf arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar
   6: sudo mv arm-2010.09 /opt/
   7: sudo ln -s /opt/arm-2010.09/bin/* /usr/bin/
   8: sudo apt-get install ia32-libs #only needed for 64-bit

Optional tasks

Splash screen tool

If your are planning to custom the splash screen in your Android system maybe you will need ImageMagick.

   1: sudo apt-get install imagemagick

ImageMagick

Search tools

A useful tool to search for files in a given directory, matching their names or contents is gnome-search-tool.

   1: sudo apt-get install gnome-search-tool

gnome-search-tool

Removable media options

When you insert a media card (SD or uSD) to download the bootloader, kernel or file system is tedious to launch applications automatically. I suggest to disable this option as below.

Never start programs on media insertion

Disclaimer

While every precaution has been taken in the preparation of this article, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

blog comments powered by Disqus