About this Article
PC requirements
Attention: Demon stration is in Ubuntu 12.04(32bit).
The Sun JDK is no longer in Ubuntu's mainpackage repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.
Download the jdk1.6:
$ dl.cubieboard.org/software/tools/android/jdk1.6.0_33.tar.gz
Input in terminal:
$ sudo vim etc/profile
Add :
JAVA_HOME=/work/tools/jdk1.6.0_33 export JRE_HOME=/work/tools/jdk1.6.0_33/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
Then save and input :
$souurce etc/profile
Download the SDK from Web Browser: http://developer.android.com/sdk/index.html
Choose the adt-bundle-linux-x86-20130219.zip
.
Input in the terminal:
$ sudo mkdir ~/sdk
Copy the adt-bundle-linux-x86-20130219.zip
to the /root/sdk and extract the zip.
Enter the folder /root/sdk/adt-bundle-linux-x86-20130219/sdk/tools
.
Double click the script file android.
It will show the Android SDK Manager. Choose the package with ticks.
Then click the Install XX
packages buttonon the right. It will start download the required packages.
After the installation, add the SDK tools to PATH Environment Variable.
Input in the terminal:
$ gedit /etc/profile
Input in the “profile”
$ export ANDROID_SDK_PATH=/root/sdk/adt-bundle-linux-x86-20130219/sdk $ export PATH=.:$ANDROID_SDK_PATH/platform-tools:$PATH
Save and close the profile.
Input in the terminal:
$ source /etc/profile
With the download of adt-bundle-linux-x86-20130219.zip
, we can find the Eclipse in the
/root/sdk/adt-bundle-linux-x86-20130219/eclipse
.
Double click the eclipse can run it.
Android Development Tools (ADT) is a plugin for the Eclipse IDE, that is designed to give you a powerful, integrated environment in which to build Android applications.
ADT extends the capabilities of Eclipse to let you quickly set up new Android projects, create an application UI, add packages based on the Android Framework API, debug your applications using the Android SDK tools, and even export signed (or unsigned). apk files in order to distribute your application.
Run the eclipse and click the help>Install New Software.
Then click the Add button.
Input the Location https://dl-ssl.google.com/android/eclipse.
Click OK. Then it will show the choice for installation.
Click Select All and Next.
The NDK is a toolset that allows you to implement parts of your app using native-codelanguages such as C and C++. For certain types of apps, this can be helpful so you can reuse existing code libraries written in these languages, but most apps do not need the Android NDK.
Download the NDK from Web Browser: http://developer.android.com/sdk/ndk/index.html
Choose the android-ndk-r8e-linux-x86.tar.bz2
.
Input in the terminal:
$ sudo mkdir ~/ndk
Copy the android-ndk-r8e-linux-x86.tar.bz2
to the /root/sdk
and extract the zip.
Input in the terminal:
$tar –xvf android-ndk-r8e-linux-x86.tar.bz2
Finally, add the NDK folder to PATH Environment Variable.
The CDT Project provides a fully functional C and C++ Integrated Development Environment based on the Eclipse platform.
Features include: support forproject creation and managed build for various toolchains, standard make build, source navigation, various source knowledge tools, such as type hierarchy, callgraph, include browser, macro definition browser, code editor with syntaxhighlighting, folding and hyperlink navigation, source code refactoring andcode generation, visual debugging tools, including memory, registers, anddisassembly viewers.
The installation of CDT is the same as ADT.
But the Location of CDT is: http://download.eclipse.org/tools/cdt/releases/indigo
The CPU X86 is using the CISC, while the ARM processor is RISO. Therefore, the cross compiling environment should be installed. The CodeSourcery is an good choice for the cross compiling. It can be download from the following website:
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
Choose the ARM Processor GNU/Linux release.
It will need your personal information. Finally, system will send you an Email with the download URL.
Click the Download Sourcery CodeBench Lite 2012.09-64.
Choose the IA32 GNU/Linux Installer.
After download, enter the folder in terminal and use the following command:
$ ln –s /lib/i386-linux-gnu/libc.so.6 /lib $ dpkg-reconfigure dash
Choose NO.
$ sh arm-2012.09-64-arm-none-linux-gnueabi.bin
Add the CodeSourvery to PATH.
Input in the terminal:
$ gedit/etc/profile
Input in the profile.
$ export PATH=.:$/root/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_LIinux/bin:$PATH
Save and close the profile.
Input in the terminal:
$ source/etc/profile
Program a simple first.c
file.
#include<stdio.h> int main() { printf(“Hello world\n”); return 0; }
Input in the terminal:
$ arm-none-linux-gnueabi-gcc–static –o first first.c $ adb push first /data/local $ adb shell $ cd /data/local $ ./first