Android programming on Mac 之安装Eclipse

1.安装包在此链接下载:    http://developer.android.com/sdk/index.html

google GoAgentFQ不好用,更新了host文件也不行,整了半天,还是一怒之下续签了vpn账号。早知如此,何必折腾。~~~~(>_<)~~~~ 

更新文件时,Mac的host必须是UTF-8格式的,所以要转换格式。

将要转换文件放入专用文件夹,终端进入该文件目录,命令行:

find *.txt -exec sh -c "iconv -f GBK -t UTF8 {} > {}.txt" \; 

GBK还是别的格式,可以先用chrome打开,查看编码。

 

2.因为打包的链接不好用,所以我自己心急跑去eclipse官网下了个独立的安装包。还得选系统是32还是64位的,经研究,我的Mac是64位硬件。但是内核怎么跑的未知。

终端命令:uname -a

Darwin liudeMacBook-Pro.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

后缀_64,就是64位的Mac。也可以按照下述方法点击,选择硬件,然后根据http://support.apple.com/kb/ht3696 查看官网的硬件说明。

点击:苹果->关于本机->更多消息->系统报告,选择软件

本来这里应该有一行“64位内核和功能扩展”,“是”代表内核按照64位在跑,“否”代表内核按照32位跑。结果我这里木有。

偷了个懒,不想换,于是下了个eclipse32位的,然后不能下安卓包还是不能用,于是回到步骤1,折腾vpn,然后自动下载,判断Mac是64位的,所以直接下了个64位的,所以要重新安装eclipse。

于是要卸载之前的安装,偷懒果然就容易坑娘啊,太特么难卸载了。当然也有可能我没用惯Mac,我无比怀念Win操作系统。嘤嘤嘤嘤。。。

 

3.Mac卸载Eclipse

先在stackoverflow上找到这个,但是我根目录那个没删,额,因为我昨天还不知道ls -la命令,(ˇˍˇ)终端渣。。。

Here is my list of things to delete for OSX Mountain Lion

~/.eclipse (folder);

~/Library/Saved Application/org.eclipse.eclipse.savedState;

~/Library/Preferences/org.eclipse.eclipse.plist;

~/Library/Caches/org.eclipse.eclipse;

... and of course the eclipse install folder

 

然后开始装步骤1下载的安装包合集,Eclipse装好后有问题。

Could not create the view: org.eclipse.mylyn.tasks.ui.views.tasks

然后又找了半天,原博这个地址:

http://renyongjie668.blog.163.com/blog/static/160053120104259285352/

内容如下:

使用Eclipse时,遇到了如下的异常,工作空间(workspace)打不开:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class  org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.***
我Google了N次,没有找到答案。
今天上午灵光一现,我换了一个workspace,就能正常打开了,不会有上面的报错了。我就想到应该是两个不同的workspace是有区别的,我到报错的workspace中看,发现有个".metadata"文件夹,里面有200多M的东东,应该是该workspace的一些属性信息,所以我删除了.metadata文件夹,然后重新打开Eclipse进入这个workspace,就可以正常工作了。Eclipse重新加载该workspace时,会重新生成.metadata的。
总之,解决方案就是:删除workspace下的.metadata文件夹,重新打开Eclipse就OK了。

 

下面还有两条有建设性的评论,摘抄在这里:

a.根据提示,.\.metadata\.plugins\里面的org.eclipse.ui文件夹就可以了,还不用全部重新更新呢

b.删除整个文件夹以后就相当于恢复了出场设置,你以前的数据库就都没有了,删除这个文件就可以正常启动com.genuitec.eclipse.ast.deploy.core.prefs

 

总之,因为我是新安装,直接按照原博主的办法就搞定了。终端渣的烂笔头:rm -rf 要删除的文件夹

 

4.Eclipse->Window->Android SDK Manager

勾选需要的包安装即可。[Android 4.4W是手表的API,如果做手机应用,还是找最新的4.x.x]

最基本:the SDK Platform ; an emulator system image ; the google APIs

 

5.Mac当前系统到底是按照32还是64位在运行?

官方文档:Archived - OS X:以 32 位或 64 位内核启动

http://support.apple.com/kb/HT3773?viewlocale=zh_CN

官方文档:Mac OS X v10.6:使用 64 位内核的 Mac

http://support.apple.com/kb/HT3770?viewlocale=zh_CN&locale=en_US

对比此文档,我的MacBook Pro是13年的,所以默认64位启动。但这个文档更新已停止,最新更新还是2011年的,所以为什么新的Mac上没有“64位内核和功能扩展”这一项没有说明,我认为,应该是后来新出的产品的都默认64位了,所以就不再标注了。

 

但是不放心的我还是查看了一下“/资源库/Preferences/SystemConfiguration/com.apple.Boot.plist”文件,对于内核模式果然没有标注,于是我画蛇添足的加了一行:

sudo systemsetup -setkernelbootarchitecture x86_64

确定修改进文件了,才放心下来。这是病,得治~

---------修改分割线-------

我没搞清楚,于是还是纠结,据说uname -a出来那行结果root:后的就是内核状态。我试着改了i386,然后uname -a,root还是_64的后缀,说明这个判断不准确。

然后继续找资料,看到这个讨论,但是他没给出处,不过很有根据的样子,我就姑且信了:

http://apple.stackexchange.com/questions/140938/how-do-i-find-out-of-my-os-x-10-9-4-is-32-bit-or-64-bit

内容:

OS X doesn't really have a single overall mode -- it can easily run different components (different processes, the kernel, etc) in different modes. It also has a multi-architecture binary format, so a single program can include both 32- and 64-bit code, and the OS will simply run it in whatever seems to be the most appropriate mode at the moment.

Over the history of OS X, it's gradually morphed from 32-bit only (through 10.2 I think), to fully 32+64-bit capable (10.6), to mostly-64-bit-only (10.8-10.9). Starting in 10.8, Apple removed the 32-bit versions of the kernel and most built-in apps, meaning that it'll only run on 64-bit CPUs. But it's still fully capable of running old 32-bit programs, and there are even a number of system programs that can run in either mode (again, to provide compatibility with old 32-bit software). The most visible example of this is the System Preferences, which normally runs in 64-bit mode, but can quit & relaunch itself in 32-bit mode to run old 32-bit-only preference panes (if you can still find one).

Note that there've never been separate 32- and 64-but versions of OS X. 10.6, for example, would install exactly the same on a 32- or 64-bit computer, and then decide at runtime which mode each program should run in.

Summary: it's not an entirely a meaningful question, but to the extent that it's meaningful Mavericks is a 64-bit OS.

基本上还是解释的很详细的,也就是说10.8以后的osX系统都是直接64位运行,但是可以兼容32位的程序。在具体运行的时候由系统判断。

---------------修改结束分割线------------------

好了,可以开始学Android programming了,呼~

posted @ 2014-10-09 16:34  太古方糖  阅读(395)  评论(0编辑  收藏  举报