Build Android Develope Enviroment
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
How to Start Android Developing
1. Prepare a Developing System
Install a 64bit/32bit Linux system.
One suggestion is the latest version of Ubuntu.
2. Install some developing tools
(1)Build essentials, execute following commands in terminal:
sudo apt-get install build-essential
(build-essential的作用 :
linux操作系统上面开发程序, 光有了gcc 是不行的,它还需要一个 build-essential软件包,作用是提供编译程序必须软件包的列表信息,也就是说 编译程序有了这个软件包,它才知道 头文件在哪,才知道库函数在哪,还会下载依赖的软件包 , 最后才组成一个开发环境,当然 build-essential包 安装时 需要的依赖包 有些你用不上
软件包: build-essential 安装方法:
sudo apt-get install build-essential )
sudo apt-get install automake
自动生成Makefile
sudo apt-get install subversion
一个免费开源的版本控制工具
3. Install Eclipse
Search Eclipse in Ubuntu Software Center and install.
/sdk/index.html 提供专门供Android使用的绑定的Eclipse和SDK
4. Install JRE and JDK
For JRE:
Install OpenJDK Java 7 from Ubuntu Software Center.
For JDK: Download the file to /Download folder from:
/technetwork/java/javase/downloads/index.html
Install:
cd ~/Downloads
sudo chmod +x jdk-6u37-linux-i586.bin
./jdk-6u37-linux-i586.bin
5. Install Android SDK
The Android SDK provides you the API libraries and developer tools.
(1) Download the SDK
Download the SDK from /sdk/index.html,
and extract to a folder such as:
/home/steveyang/Documents/android-sdk-linux
(2) Install the SDK
Open the SDK client with the following commands:
cd /home/steveyang/Documents/android-sdk-linux/tools
./android
Install the Android SDKs after Android2.3.3 with the client.
(3) Install Eclipse plugins
Follow the guide in:
/sdk/installing/installing-adt.html
Start Eclipse, then select Help > Install New Software.
Click Add, in the top-right corner.
In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the
following URL for the Location:
/android/eclipse/
6. Install NDK
The NDK allows you to implement parts of your app with native-code languages such as
C and C++.
Download the NDK_r8e for Linux from the below link:
/android/ndk/android-ndk-8e-linux-x86.tar.bz2
Extract the NDK_r8e package, to a path such as
/opt/androidbuild/android-ndk-r8e
sudo chmod -R 755 /opt/androidbuild/android-ndk-r8e
7. Config build settings
(1) Config system environment:
sudo ln -s /home/steveyang/Documents/android-sdk-linux /opt/android-sdk-linux_x86
Add environment variable::
gedit .bashrc
export NDK_HOME=/opt/androidbuild/android-ndk-r8e
export JAVA_HOME=/home/steveyang/Downloads/jdk1.6.0_37
export JRE_HOME=/home/steveyang/Downloads/jdk1.6.0_37/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$NDK_HOME:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
source .bashrc
命令用法:
source FileName
作用:在当前bash环境下读取并执行FileName中的命令。
注:该命令通常用命令“.”来替代。
如:source /etc/profile 与 . /etc/profile是等效的。
注意:source命令与shell scripts的区别是, source在当前bash环境下执行命令,而scripts是启动一个子shell来执行命令。这样如果把设置环境变量(或alias等等)的命令写进scripts中,就只会影响子shell,无法改变当前的BASH,所以通过文件(命令列)设置环境变量时,要用source 命令。
(2) Eclipse project:
a. Import project:
ui/MediaFramework/SampleApp/Android/mfw_samples
ui/MediaFramework/SDK/Android/build/MFWSdk
ui/MediaFramework/SampleApp/Android/ThemePhone
ui/MediaFramework/SampleApp/Android/ThemeTablet
ui/MediaFramework/SampleApp/Android/ FileExplorer