
方法:首先启动安卓系统,然后将linux的系统镜像文件挂载为安卓系统的一个分区(所以设备必须支持Loop设备),然后通过chroot命令切换程序执行时所参考的根目录即可。这样我们就可以使用系统镜像文件里的 *** 作系统了。
需要用到的几个软件:BusyBox Pro,Complete Linux Installer(内含终端模拟器 VNC安卓客户端和Linux镜像下载链接),适合于Arm的Ubuntu镜像。这几个软件都可以从Google Play里下载到,其中BusyBox Pro是收费应用,网上应该也有免费的下载,可以搜一下。另外Complete Linux Installer也带有BusyBox如果不想下载那个收费的,用这里带的或许也可以,但是可能会报告一个错误。
软件安卓好之后,将Ubuntu镜像放到SD卡里,最好是Class 10的高速卡,不然可能会稍微卡一点,但是不会非常卡,因为大多数的 *** 作还是依赖于安卓系统构建的系统的了,这跟直接将系统镜像写入SD卡并从SD卡启动不同。这个镜像文件需要放到SD卡的一个文件夹下,注意一定不能使中文。然后打开Complete Linux Installer,里面有一个启动 *** 作系统,右上角会有一个菜单编辑,名称任意,路径当然就要选择我们的镜像所致的路径了,保存并返回。此时点击启动即可启动linux系统。此时会启动终端模拟器,提示几个问题,如果是第一次启动会让设置密码,设置好密码之后,再依次输入y,最好设置分辨率,y,即可。如果启动失败,可以多试几次即可。
之后可以打开VNC客户端,连接127.0.0.1:5900输入刚才设置的用户名密码即可连接登陆。如果显示被拒绝连接,可以检查一下端口号是否正确。检查的方法是到终端模拟器执行 netstat -tlnp 看一下vncserver前面对应的端口号码是多少,再到VNC客户端改为相应的端口号即可。
1、系统环境
[android@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32-71.el6.i686 #1SMP Wed Sep 1 01:26:34 EDT 2010 i686 i686 i386 GNU/Linux
[android@localhost ~]$ lsb_release -a
LSB Version: :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.0 (Santiago)
Release: 6.0
Codename: Santiago
[android@localhost ~]$
2、准备软件
java
eclipse
android-sdk
ADT
这些软件都可以在官网上下载。
3、搭建过程
(1) 安装java
[android@localhost ~]$ rpm -qa | grep java
eclipse-mylyn-java-3.3.2-4.5.el6.i686
java-1.6.0-openjdk-devel-1.6.0.0-1.21.b17.el6.i686
java-1.6.0-openjdk-1.6.0.0-1.21.b17.el6.i686
tzdata-java-2010l-1.el6.noarch
gcc-java-4.4.4-13.el6.i686
java-1.5.0-gcj-1.5.0.0-29.1.el6.i686
subversion-javahl-1.6.11-2.el6.i686
ooobasis3.3-javafilter-3.3.0-9567.i586
libvirt-java-0.4.5-2.el6.noarch
lpg-java-compat-1.1.0-4.1.el6.noarch
libvirt-java-devel-0.4.5-2.el6.noarch
mysql-connector-java-5.1.12-2.el6.i686
ant-javamail-1.7.1-13.el6.i686
java-1.6.0-openjdk-javadoc-1.6.0.0-1.21.b17.el6.i686
java_cup-0.10k-5.el6.i686
[android@localhost ~]$
通过命令查看当前已经安装了java的相关jdk,可以进行下一步。
(2) 安装eclipse
从官网上下载的eclipse不需要按装,直接解压即可使用。如:
[android@localhost Base Env]$ ls
ADT-18.0.0.zip
android-sdk_r18-linux.tgz
Android开发环境搭建(Linux篇).doc
eclipse
eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz
Linux环境搭建.doc
Linux 下Android 开发环境搭建 .doc
[android@localhost Base Env]$ rm -R eclipse
[android@localhost Base Env]$ ls
ADT-18.0.0.zip
android-sdk_r18-linux.tgz
Android开发环境搭建(Linux篇).doc
eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz
Linux环境搭建.doc
Linux 下Android 开发环境搭建 .doc
[android@localhost Base Env]$ tar -zxfeclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz
[android@localhost Base Env]$ ls
ADT-18.0.0.zip
android-sdk_r18-linux.tgz
Android开发环境搭建(Linux篇).doc
eclipse
eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz
Linux环境搭建.doc
Linux 下Android 开发环境搭建 .doc
[android@localhost Base Env]$ cd eclipse
[android@localhost eclipse]$ ls
about_files configuration eclipse.ini icon.xpm p2
about.html dropins epl-v10.html libcairo-swt.so plugins
artifacts.xml eclipse features notice.html readme
[android@localhost eclipse]$ ll
总用量 540
drwxrwxr-x. 2 android android 4096 2月 17 03:06 about_files
-rw-rw-r--. 1 android android 18909 2月 8 21:55 about.html
-rw-rw-r--. 1 android android 88246 2月 17 03:06 artifacts.xml
drwxrwxr-x. 5 android android 4096 2月 17 03:06 configuration
drwxrwxr-x. 2 android android 4096 2月 17 03:06 dropins
-rwxr-xr-x. 1 android android 62814 2月 8 22:16 eclipse
-rw-rw-r--. 1 android android 407 2月 17 03:06 eclipse.ini
-rw-rw-r--. 1 android android 16536 2月 8 21:36 epl-v10.html
drwxrwxr-x. 46 android android 4096 2月 17 03:06 features
-rw-rw-r--. 1 android android 9022 2月 8 21:54 icon.xpm
-rwxr-xr-x. 1 android android 266168 2月 8 21:54 libcairo-swt.so
-rw-rw-r--. 1 android android 8951 2月 8 21:36 notice.html
drwxrwxr-x. 5 android android 4096 2月 17 03:05 p2
drwxrwxr-x. 10 android android 36864 2月 17 03:06 plugins
drwxrwxr-x. 2 android android 4096 2月 17 03:06 readme
[android@localhost eclipse]$ ./eclipse
启动eclipse之后,eclipse会自动创建并寻找workspace文件夹,可以直接点击ok按钮即可。eclipse的启动过程如下图所示:
eclipse也可以在gnome桌面下直接双击eclipse可执行文件启动。
(3) 安装android-sdk
[android@localhost Base Env]$ tar -zxfandroid-sdk_r18-linux.tgz
[android@localhost Base Env]$
ls
ADT-18.0.0.zip
android-sdk-linux
android-sdk_r18-linux.tgz
Android开发环境搭建(Linux篇).doc
eclipse
eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz
Linux环境搭建.doc
Linux 下Android 开发环境搭建 .doc
[android@localhost Base Env]$
cdandroid-sdk-linux/
[android@localhost android-sdk-linux]$
ls
add-ons platforms SDK Readme.txt tools
[android@localhost android-sdk-linux]$ cd
tools/
[android@localhost tools]$ ll
总用量 6772
-rw-rw----. 1 android android 323 3月 30 23:20 adb_has_moved.txt
-rwxrwx---. 1 android android 3491 3月 30 23:19 android
drwxrwx---. 2 android android 4096 3月 30 23:19 ant
-rwxrwx---. 1 android android 1977 3月 30 23:19 apkbuilder
drwxrwx---. 3 android android 4096 3月 30 23:19 apps
-rwxrwx---. 1 android android 3116 3月 30 23:19 ddms
-rwxrwx---. 1 android android 46724 3月 30 23:19 dmtracedump
-rwxrwx---. 1 android android 1940 3月 30 23:19 draw9patch
-rwxrwx---. 1 android android 24828 3月 30 23:19 emulator
-rwxrwx---. 1 android android 2814128 3月 30 23:19 emulator-arm
-rwxrwx---. 1 android android 2765428 3月 30 23:19 emulator-x86
-rwxrwx---. 1 android android 136860 3月 30 23:19 etc1tool
-rwxrwx---. 1 android android 3282 3月 30 23:19 hierarchyviewer
-rwxrwx---. 1 android android 9680 3月 30 23:19 hprof-conv
drwxrwx---. 6 android android 4096 3月 30 23:19 lib
-rwxrwx---. 1 android android 2015 3月 30 23:19 lint
-rwxrwx---. 1 android android 9676 3月 30 23:19 mksdcard
-rwxrwx---. 1 android android 3169 3月 30 23:19 monkeyrunner
-rw-rw----. 1 android android 379587 3月 30 23:20 NOTICE.txt
drwxrwx---. 7 android android 4096 3月 30 23:19 proguard
-rw-rw----. 1 android android 66 3月 30 23:19 source.properties
-rwxrwx---. 1 android android 613856 3月 30 23:19 sqlite3
drwxrwx---. 2 android android 4096 3月 30 23:19 support
-rwxrwx---. 1 android android 3044 3月 30 23:19 traceview
-rwxrwx---. 1 android android 46784 3月 30 23:19 zipalign
[android@localhost tools]$ ./android update sdk
此处即打开了android模拟器的升级更新界面,如下图所示:
接下来的 *** 作主要是对该模拟器中的相关包进行下载升级,需要的时间可能会很长(本人在进行升级时基本上会在晚上保持开机,因为Android系统之间得不兼容性。当然,您如果只是针对某一个Android系统版本,那会快很多。不过在以后也可以追加下载安装的。):
您可以选择Aceept all:
点击Install按钮之后,您会跳转到下面的界面中,其中,在该对话框的最下面,您会看到当前包的下载速度与进度:
AndroidSDK
Manager有时候也会d出下面的log对话框,这里面可以看到更加详细的信息(您可以关闭该对话框。如果您下一次确实需要看,您可以点击后色按钮后面的那个按钮,管理器会打开日志对话框):
在android-sdk安装成功之后,在该目录下,Android SDK
Manager会创建platform-tools文件夹,该文件夹中包含了您已定会用到的adb等android命令。
下载过程中,SDK Menager会d出如下图的站点认证信息,可忽略该认证:
在下载安装完成后,安卓SDK 管理器会d出下面的对话框:
此时,您可以勾选标注为Not
installed的相关包,点击Install*package可以安装您选择的没有安装的相关包,但此时安装的包大都需要您给出站点认证信息。相关信息截图如下
至此,Android SDK Manager安装完毕。
(4) 安装ADT插件
首先,您要启动eclipse;
在IDE中点击Help->Install New Software...打开eclipse的Install对话框,如下图所示:
Android是一种基于Linux的自由及开放源代码的 *** 作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。也就是说Android的底层就是Linux,如果想像linux那样执行一些命令的话,可以使用adb,或者说shell终端。
使用方式:
在电脑上用adb 执行shell脚本 命令 adb shell即可切换到shell模式。
手机上安装shell 附件,启动后即可执行命令。
su切换到root用户执行高级命令。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)