Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15342158
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2008-04-16 11:53:25

linux下安装Android开发环境
ubuntu7.10 安装 Android
上次介绍完Android之后,连我自己都被自己说动了,准备亲自尝试一下这玩意,当然不是为了那10000000美金吶,所有认识的人都知道我不用 Java。只是我本身对这个平台很感兴趣,也希望看一看其上层库与底层Linux结合的机制,就想试一下了。其实对Java一直持比较排斥的态度的,总觉得C才是正统用来作嵌入式的语言,不过没办法,谁让是人家定标准呢,考虑到一次编译到处运行的机制,Google选择Java还是蛮有道理的。好了,同志们,我们不仅要对Google有爱,更要勇敢秀出来。

OK,首先,就是安装Eclipse以及JDK和JRE。

    sudo apt-get install eclipse

    sudo apt-get install sun-java6-jdk

    sudo apt-get install sun-java6-jre

(
下载Android SDK
wget
尽量多线程下载,因为近期下载的人会很多,那是一定的
axel -n 10
)
然后就是去总站下载android_sdk_linux_m3-rc20a,解压,能看到解压出了几个文件和目录。记住解压出来的tools这个文件夹的路径,在.bashrc文件中,将该路径增加到Path变量。如果.bashrc中本来没有对Path的定义,则直接添加一句export PATH=${PATH}:/tools即可。这样作的目的,是让你无须进入这个tools就可以使用Android Debug Bridge (adb)以及其他一些命令行工具。顺便要注意,当这个路径改变或者升级你的SDK的时候,要记住更新这个path变量。怎么知道成功没有呢?重开终端或者source一下新的.bashrc,然后在终端中执行acp,一旦有程序用法提示,就表示path变量修改成功。

接下来就应该安装Eclipse Plugin(ADT)了。这个是针对希望拿Eclipse作为开发IDE的朋友的,事实上Google官方推荐用Eclipse来作为你的开发IDE,可以理解,毕竟是Java开发么,不过我估计过两天还是会探索一下不用Eclipse开发的方法。这个ADT是Android Development Tools,增加了对于Android projects和tools的集成化支持,其中包括了各种各样的强大的扩展,能让你更快和更方便地创建运行以及调试Android应用程序。 OK,至于安装办法嘛,Google文档上有很详细的描述,我这里就可耻地直接copy过来了

    To create the project, follow these steps:

       1. Start Eclipse, then select Help > Software Updates > Find and Install….
       2. In the dialog that appears, select Search for new features to install and press Next.
       3. Press New Remote Site.
       4. In the resulting dialog box, enter a name for the remote site (e.g. Android Plugin) and enter this as its URL:

         

          Press OK.
       5. You should now see the new site added to the search list (and checked). Press Finish.
       6. In the subsequent Search Results dialog box, select the checkbox for Android Plugin > Eclipse Integration > Android Development Tools and press Next.
       7. Read the license agreement and then select Accept terms of the license agreement, if appropriate. Press Next.
       8. Press Finish.
       9. The ADT plugin is not signed; you can accept the installation anyway by pressing Install All.
      10. Restart Eclipse.
      11. After restart, update your Eclipse preferences to point to the SDK directory:
             1. Select Window > Preferences… to open the Preferences panel. (Mac OS X: Eclipse > Preferences)
             2. Select Android from the left panel.
             3. For the SDK Location in the main panel, press Browse… and locate the SDK directory.
             4. Press Apply, then OK

    To update the ADT plugin to the latest version, follow these steps:

       1. Select Help > Software Updates > Find and Install….
       2. Select Search for updates of the currently installed features and press Finish.
       3. If any update for ADT is available, select and install.

    Alternatively,

       1. Select Help > Software Updates > Manage Configuration.
       2. Navigate down the tree and select Android Development Tools
       3. Select Scan for Updates under Available Tasks.

OK,我们现在已经配置完成了开发环境,接下来就是新建一个Android应用程序,运行和调试它。当然是针对Android for Eclipse 插件进行的,因为我还没有研究别的方式^_^.

要开发一个Android程序,首先当然是创建工程了。如果你前面安装顺利,那么File > New > Project里面就会出现Android的选项,一路选下去,设置好,Finish后就可以在工程目录下看到项目配置文件 AndroidManifest.xml以及存放源代码和库等东西的文件夹。先不管这,试一下运行和调试吧。选择Run > Run,弹出的对话框中选择Android Application--》New_configuration,属性框里面Android标签下把Project和Activity选上,另外两个标签先不管,Apply就行了。

最后,点击这个对话框下面的Run,嘿嘿,告诉我,你看见了什么?
(Android Game QQ群40445621武林大会)
阅读(7388) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~