[GUIDE] Setup Android Development Environment on Ubuntu 14.04 Trusty Tahr

Hi All,

This originally was posted in the i.MX Solutions, but I was asked to move it here for higher visibility. This has been updated as of 7/19/2014. With Ubuntu 14.04 LTS Trusty Tahr being up and running, I decided to post this guide to help anyone wanting to move over to it. I personally believe this is the best Ubuntu yet. This has come from my trial and errors, searching all over the web, and bits I picked up from here and there. You should have a fully functional android development environment once this is completed. NOTE-------- some of these packages may already be on your machine. Obviously, if you complete a step and you have one of these installed, the machine simply will not do anything. So...it will not hurt anything. Some of the packages are different from Ubuntu 12.04 and 13.04 (use these packages for Ubuntu 14.04 as many of the old ones have obsoleted - these are new replacements).

The first thing I highly recommend installing is "Muon Package Manager" from the Ubuntu Software Center. I will be referring to it to install some packages.

Next...

Installing Python

Open terminal (CTRL + ALT + T)

Then execute the following commands in terminal one by one:

$ sudo apt-get install build-essential gcc
$ wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
$ tar -xvzf Python-2.7.6.tgz
$ cd Python-2.7.6
$ ./configure --prefix=/usr/local/python2.7
$ make
$ sudo make install
$ sudo ln -s /usr/local/python2.7/bin/python /usr/bin/python2.7

Now Python is configured
Installing The JDK

Add PPA to system
$ sudo add-apt-repository ppa:webupd8team/java

Download & install java
$ sudo apt-get update && sudo apt-get install oracle-java6-installer

CHECK

$ java -version

You should see something like:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

If not (I have had trouble with this i the past), go to:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html
(in your browser and manually download)

You will have to login or setup an account with Oracle if you do not have one.
Put the "jdk-6u45-linux-x64.bin" in the home directory.
Then we need to run the binary and move it to a shared location by opening a terminal and typing:

$ chmod +x jdk-6u45-linux-x64.bin
$ sudo ./jdk-6u45-linux-x64.bin
$ sudo mv jdk1.6.0_45 /usr/lib/jvm/

Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer:

$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1
$ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_45/bin/javap 1  (EDIT - This is needed to compile Kit Kat 4.4)

Most of the time I get after these commands, basically the jdk is not there. Just run the binary and move it to a shared location using three commands above again and install and give them the highest priority again...its a pain, I know)

Now check if JDK 1.6 is selected on this:

$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config jar
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javap  (EDIT - This is needed to compile Kit Kat 4.4)

These six should all be selected.
Now JDK is configured! To check if it is done

Execute this is Terminal:
$ java -version

Output will be similar to this:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

IF NOT, YOU MAY NEED TO RUN AGAIN

JDK is now configured. You can now delete or save somewhere else "jdk-6u45-linux-x64.bin"  that is in the home directory

Installing GNU Make (use only make-3.81; this was designed for android)
$ wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
$ tar -xvzf make-3.81.tar.gz
$ cd make-3.81
$ ./configure
$ sudo make install

Now GNU make is configured

Installing Android SDK

Download the SDK from:
http://developer.android.com/sdk/index.html

Accept Terms & download 64 bit.
Extract in your home directory & rename extracted folder "adt".
Now, execute these commands in terminal:

$ cd ~/adt/sdk/tools/
$ ./android sdk

At this point the SDK should come up and you will need to download at least all the tools and all the extras files (at least to 4.0, so select them and install them.When it finishes downloading & installing everything you have to run this command in ANOTHER TERMINAL:

$ sudo gedit .bashrc

And you need to add at the end of it your SDK paths these three lines (cop and paste them):
#Android PATHS
export PATH=$PATH:~/adt/sdk/tools
export PATH=$PATH:~/adt/sdk/platform-tools

Save and close the file, then close terminals.
SDK is configured.

Setup ADB & Fastboot

These packages are needed to run many many android commands such as ADB and FASTBOOT (only 64-bit needs this). Using Muon Package Manager, get these three packages:
lib32z1
lib32ncurses5
lib32bz2-1.0

Configuring USB Access

Go to:
snowdream/51-android · GitHub
Download "51-Android.rules"
Add these lines in alphabetical order:

#Sabresd
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0777"
SUBSYSTEM=="usb|usb_device", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

Open Terminal and type:
$ gksudo nautilus

In the pop up, Go back to hard drive & navigate to: /etc/udev/rules.d

Copy & paste 51-android.rules

Save and close the file, then close the window.

Set the right permissions to this file:
$ sudo chmod 644   /etc/udev/rules.d/51-android.rules
$ sudo chown root. /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
$ sudo killall adb

ADB & Fastboot are configured
Installing Required Packages
Open Terminal

Now execute this command:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool

When that is finished, execute these commands:
$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git-core curl
$ sudo apt-get install u-boot-tools
$ sudo apt-get install cbootimage
$ sudo apt-get install dfu-util
$ sudo apt-get install libterm-twiddle-perl

Using Muon Package Manager install these packages (again some of these may already be installed):
original-awk
cl-awk
dpkg-awk
gawk
mawk
sed
ssed
abootimg

Installing Repo Package

Open terminal and type:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Now it is recommended to reboot your computer !!!!
 
Extra Packages Needed For Ubuntu 14.04 Trusty Tar

These must be installed to avoid an issue that comes up during the android build causing an error.

Open Muon Package Manager and type "cpanm" and install:
libmodule-cpafile-perl
cpanminus
pmuninstall

Next, type in "libperl" and install if not installed:
libperl-dev
libperl-apireference-perl
libperl5.18
libperl6-caller-perl
libperlio-gzip-perl
libperl4-corelibs-perl
libperl5i-perl

Next, type in "perl" and install if not installed:
perl
perl-base
libxml-perl
libfile-find-rule-perl-perl
libprobe-perl-perl
libmodern-perl-perl
perl-modules

Close Moun Package Manager

Open a terminal and type:
$ cpan App::cpanminus
(answer "yes" then "sudo" and then "yes" when asked)
$ sudo cpanm Switch

Configure Git

Open terminal and type:
$ git config --global user.email "<your email address here>"
$ git config --global user.name "<your user name here>"

Git is configured.

Istall Ccache

Download "ccache 3.1.9 source code (tar.gz)" (or higher) from:
http://ccache.samba.org/download.html
Extract to the home directory.

Open terminal & execute:
$ cd ccache-3.1.9
$ ./configure
$ make
$ make install
$ sudo gedit make install.bashrc

Copy & paste the following:
export USE_CCACHE=1
Save & close

Open terminal & execute:
$ ccache -M 75G

I usually use 75 gigs.
Ccache is now set to 75 gigs.
Generating SSH Keys

Check for SSH keys in the terminal:
$ cd ~/.ssh
$ ls

Check the directory listing to see if you have a file named either id_rsa.pub or id_dsa.pub. If you don't have either of those files go on. Otherwise, you already have an existing key pair, and you can skip to "Add your SSH key to GitHub".

Generate a new SSH key.

To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.Type in the terminal:

$ ssh-keygen -t rsa -C "<your email address here>"

Will ask for pass phrase twice; just press enter twice.
Add your SSH key to GitHub
Run the following code to copy the key to your clipboard:

$ sudo apt-get install xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub
 
Go to your github account (create one if you do not have one) & add your new public key.
GitHub · Build software better, together.
Test everything out.

Type in the terminal:
$ ssh -T git@github.com

You may see this warning:

The authenticity of host 'github.com (207.97.227.239)' can't be established.

# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?

Type in "yes"; you should get this:
Hi username! You've successfully authenticated, but GitHub does not # provide shell access.

If the username is correct, you've successfully set up your SSH key.

YOUR BUILD ENVIROMENT IS NOW SETUP

https://community.freescale.com/thread/327811

Android.mk: recipe commences before first target. Stop.的更多相关文章

  1. Android.mk 文件语法详解

    0. Android.mk简介: Android.mk文件用来告知NDK Build 系统关于Source的信息. Android.mk将是GNU Makefile的一部分,且将被Build Syst ...

  2. Android.mk 基本应用

    如果是在android源码里面编译我们自己的应用,就需要这个android.mk文件,这个文件就告诉android系统应用如何来编译这个应用以及这个应用它所依赖哪些文件等等信息.我对android.m ...

  3. android mk odex问题 push apk 不生效

    Android编译是否生成odex的设置 默认编译odex版本,如果需要非odex版本,请将device/huawei/k3v2_s10/BoardConfig.mk如下两个变量的值修改为:DISAB ...

  4. Android.mk的用法和基础【转】

    一个Android.mk file用来向编译系统描述你的源代码.具体来说:该文件是GNU Makefile的一小部分,会被编译系统解析一次或多次.你可以在每一个Android.mk file中定义一个 ...

  5. Android.mk学习 笔记

    感谢: 原创作品 转载请注明出处:http://www.cnblogs.com/langlang/ 作者email: dayhappyhappy@163.com LOCAL_PATH := $(cal ...

  6. Android.mk 文件语法详解 转:http://blog.sina.com.cn/s/blog_602f8770010148ce.html

    0. Android.mk简介: Android.mk文件用来告知NDK Build 系统关于Source的信息. Android.mk将是GNU Makefile的一部分,且将被Build Syst ...

  7. Android.mk

    Introduction: Android.mk编译文件是用来向Android NDK描述你的C,C++源代码文件的, 这篇文档描述了它的语法.在阅读下面的内容之前,假定你已经阅读了docs/OVER ...

  8. NDK(10)Android.mk各属性简介,Android.mk 常用模板

    参考 : http://blog.csdn.net/hudashi/article/details/7059006 本文内容: Android.mk简介, 各属性表, 常用Android.mk模板 1 ...

  9. 解决 Cocos2d-x 中 Android.mk 手动添加源文件

    转自:http://blog.csdn.net/ypfsoul/article/details/8909178 Makefile Android.mk 引发的思索 在我们编写 Android 平台 c ...

随机推荐

  1. 项目记事【SpringMVC-2】:将后台的对象,转成JSON报文

    Spring版本:3.2.7 Jackson版本: <!--Jackson --> <dependency> <groupId>com.fasterxml.jack ...

  2. CSS:IE,Chrome,Firefox兼容性和CSS Hack(转载)

    原作者:微米博客 以前写过一篇关于CSS hack的文章,但近期回头看了看发现理解的不够深刻,总结的也不凝练,于是今天重新测试从新写一篇.常用的CSS hack如下(笔者只对IE&FF& ...

  3. BZOJ 4552 [Tjoi2016&Heoi2016]排序 ——线段树 二分答案

    听说是BC原题. 好题,二分答案变成01序列,就可以方便的用线段树维护了. 然后就是区间查询和覆盖了. #include <map> #include <cmath> #inc ...

  4. P1108 低价购买 (动态规划)

    题目链接 Solution 似乎就是个很简单的最长不上升子序列输出方案. 但是有一个很艹蛋的条件: 不同方案选择价格必须不同. 且其股票价格不保证不相同. \(f[i]\) 代表以第 \(i\) 天结 ...

  5. maven打包加入依赖包以及加入本地依赖包的方法

    Maven引入本地Jar包并打包进War包中 1.概述 在平时的开发中,有一些Jar包因为种种原因,在Maven的中央仓库中没有收录,所以就要使用本地引入的方式加入进来. 2. 拷贝至项目根目录 项目 ...

  6. llinux 定时器 转载自 http://blog.chinaunix.net/uid-11848011-id-96374.html

    这篇文章主要记录我在试图解决如何尽可能精确地在某个特定的时间间隔执行某项具体任务时的思路历程,并在后期对相关的API进行的归纳和总结,以备参考. 问题引出 很多时候,我们会有类似“每隔多长时间执行某项 ...

  7. rostopic pub

    rostopic pub -1 reinit_motor_wheel std_msgs/String -- "reinit_motor_wheel"rostopic pub -r ...

  8. 链表的排序 时间复杂度O(nlogn)

    思路:用归并排序.对一个链表采用递归进行二等分,直到每个部分有序,然后对其进行合并.其实就是两步,先分解,然后合并有序链表. 代码: //对链表采用递归排序 class Solution { publ ...

  9. (BruteForce)暴力破解经典题目总结

    在算法竞赛中,很多问题是来不及用数学公式推导出来的.或者说根本就找不到数学规律,这时我们就需要使用枚举来暴力破解. 不过枚举也是需要脑子的,一味的暴力只能超时.因此我这里选择了几道mooc上经典的题目 ...

  10. fastscripT实现权限控制

    fastscripT权限控制 此处以FASTSCRIPT实现功能权限为例,用脚本实现数据权限也是很方便的. unit Unit1; interface uses Winapi.Windows, Win ...