cics for linux,Linux下搭建Android开发环境图文详解

二、安装eclipse:

在Linux 下安装Eclipse 比较简单,只需要到如下的页面下载合适的Eclipse for Linux: 的最新版本即可(注意自己的机器是32 位的Linux 还是64 位的Linux 机器)。

解压:

sudo tar –zxvf eclipse-jee-mars-2-linux-gtk-x86_64.tar.gz

解压后会得到一个Eclipse 目录,进入该目录后,会看到一个Eclipse 可执行文件,如图黑框中所示。执行该文件即可启动Eclipse .

f1cc0945c2659914e2c77773425c7b6e.png

启动eclipse,选择help-Install New Software

work with为    http://dl-ssl.google.com/Android/eclipse/

选择安装  android development tools

如果安装过程中出现错误:

The operation cannot be completed. See the details

如果安装WST的过程出现错误:

An error occurred while installing the itemssession context was:(profile=PlatformProfile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Install, operand=null –> [R]org.eclipse.ant.ui 3.4.1.v20090901_r351, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.InstallBundleAction).

The artifact file for osgi.bundle,org.eclipse.ant.ui,3.4.1.v20090901_r351 was not found.

有可能没有安装Eclipse 的eclipse-pde或eclipse-jdt插件

我的错误:

f7a38f2ae2e1097c60e93c6b7d5b07ed.png

由于google已经转向Android Studio。所以网上的方法可能无法解决,那就选择离线安装吧。

到Linux公社1号FTP服务器下载(有更多您喜欢的)

------------------------------------------分割线------------------------------------------

用户名:ftp1.linuxidc.com

密码:www.linuxidc.com

在 2016年LinuxIDC.com\5月\Linux下搭建Android开发环境图文详解\

------------------------------------------分割线------------------------------------------

09c73cd94d3a0c536051342adf4e8140.png

复制*.zip到eclipse目录下,在Eclipse中,”help” – “Install New Software” – “Add” – “Archive” 选择下载的ADT Archive包即可。这种方式要断网安装,否则安装不成功。

只安装ADT 还不能用来开发,还需要配置ADT,以便让ADT 能找到Android SDK。在Eclipse中单击“Window”>“Preferences” 菜单项, 会显示“Preferences”对话框,如图所示。单击左侧的“Android "节点,在右侧的“SDK Location" 文本框中输入Android SDK 的安装目录,然后单击“Apple”按钮, 会将当前Android SDK支持的Android版本都列出来,最后单击“OK”按钮关闭“ Preferences” 对话框。

6b4fadd9f28ac8872a556319d9273a1a.png

最终安装图片:

941267d014f96aa7465185cd4522293e.png

如果出不来AVD小图标,可以去-------Windows---Perspective-----Customize Perspective设置如下配置:

7ef0ece0886a5315a12321c17c8e9eff.png

安装交叉编译环境:

X86架构的CPU采用的是复杂指令集计算机(Complex Instruction Set Computer, CICS ),而ARM 架构的CPU 使用的是精简指令集计算机( Reduced lnstruction Set Computer, RISC)。由于这两种架构的CPU 使用了不同的指令集, 因此在·xs6 架构上开发可运行在ARM 架构上的程序就必须要使用交叉编译器。通常交叉编译器和相关工具包含了很多可执行文件以及大量的共享库及头文

件等资源。这些资源的集合称为交叉编译环境。

我们自己可以编译制作一个交叉编译工具链(Cross-compile Toolchain)来用,但为了方便、稳定起见,我们大多数时候会去选择成熟的第三方工具链。

dcd7fe71e96e7af912e624c9e8b8df41.png

可以看到有2个OS平台版本可供选择,选择第一个下载。

ec0dd9316287a0bc75f338381790e643.png

现在应该选择哪个呢?在codesourcery的一个页面上我们找到了答案:

This table appliesto the target system on which your applications will run, not to the host system on which you run Sourcery G++.

Target Platform Description

EABI/ELF RTOS systems or bare metal systems where no operating system is present. These configurations should not be used to build Linux kernels or applications.  用于RTOS或者没有os的硬件设备。这个配置不能用于构建内核或者应用程序。

uClinux™ Systems running uClinux, i.e. Linux on CPUs without an MMU. Use Sourcery G++ to build both the uClinux kernel and applications.

GNU/Linux® Systems running full Linux, i.e., Linux on CPUs with an MMU. Use Sourcery G++ to build both the Linux kernel and applications.  这个用于运行带有MMU的CPU上的linux系统。可以构建linux内核和应用程序。

Microsoft Windows® Systems running Microsoft Windows 2000, or later.

也就是说,如果打算用来编译linux kernel或者基于linux的应用程序,则应该选择GNU/Linux;EABI/ELF适用于没有操���系统(或者RTOS)的裸机;uClinux适用于没有MMU的Linux。

0228355d0b0f8f3d9d4c2e28f90f746e.png

Linux版本的安装文件是bin格式,读者可执行下面的命令安装CodeSourcery。其中package表示CodeSourcery的安装文件名。

sh package.bin

执行上面的命令后,会显示可视化的安装界面,如图2-32所示,读者可按提示安装CodeSourcery。

c9f20bbd6fafa8ec7ed37ffa474ad512.png

注意:64位系统无法执行上面的语句,如图:

3f96982d86aae1f9724086ff06f4de39.png

解决办法:

49f26502f194b312deb4f6d60da59ad6.png

132093cb71770761d12643d1e01f4014.png

为了使用方便,建议读者将如下路径加到PATH环境变量中。(新版本不需要)

/root/compilers/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin

下面编写一个简单的C程序来测试一下这个交叉编译环境。

//  first.c

#include

int main()

{

printf("first arm program\n");

return 0;

}

输入下面的命令编译first.c文件(需要加-static选项)。

# arm-none-linux-gnueabi-gcc -static -o first first.c

输入下面的命令将first文件上传到任意的Android设备的/data/local目录中(没有root权限也可以)。

# adb push first /data/local

使用adb shell命令进入Android设备的控制台,并进入/data/local目录,执行如下的命令

# ./first

执行上面的命令就会输出“first arm program”信息。first程序在X86架构上运行的Ubuntu Linux中是无法运行的。读者可以试着在Ubuntu Linux中运行first程序,看看会发生什么。

注意:在安装Code Sourcery的过程中会在/lib目录寻找一个libc.so.6库文件,但在Ubuntu Linux11.04及以上版本/lib目录已经没有libc.so.6库文件了。这个库文件被放在了其他的目录。在32位的Ubuntu Linux中该文件的路径是/lib/i386-linux-gnu/libc.so.6,在64位的Ubuntu Linux中该文件的路径是/lib/x86_64-linux-gnu/libc.so.6。在安装Code Sourcery之前可以使用ln命令为libc.so.6文件在/lib目录建立一个链接。0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值