现在的位置: 首页 > 综合 > 正文

2. Eclipse +android 4.2的第一个应用程序Hello World

2013年09月06日 ⁄ 综合 ⁄ 共 1060字 ⁄ 字号 评论关闭

1.

从官方网站上面http://developer.android.com/sdk/index.html下载打包好的android 开发环境包,自动解压安装。

     安装了ADT插件和NDK插件:

    在Eclipse的工具栏里面找到help->install new software,

Add Repository 对话框中,Name随便起个名字,然后Location输入:

https://dl-ssl.google.com/android/eclipse/

选择相应的开发组件,特别是NDK PLUGINS,以便将来利用C++、C的本地代码进行开发。

 2. 配置相关的环境变量。

  ADB_ROOT:D:\develop\adt-bundle-windows-x86\sdk\platform-tools

NDK_ROOT: D:\develop\android-ndk-r8d

3.根据官网上的说明建立第一个应用程序。

  创建 AVD, 然后运行编写的Hello world 程序。

注意期间会出现1个错误:

.报错: 
The connection to adb is down, and a severe error has occured. 
[2010-03-11 09:36:56 - HelloOPone] You must restart adb and Eclipse. 
[2010-03-11 09:36:56 - HelloOPone] Please ensure that adb is correctly located at 'D:\develop\adt-bundle-windows-x86\sdk\platform-tools\adb.exe'
and can be executed. 

从网上找了些解决方法,

(1)http://logger.iteye.com/blog/911977

(2)http://www.crifan.com/android_adt_the_connection_to_adb_is_down__and_a_severe_error_has_occured/

但是都没有解决,根据看到的方法,估计是adb运行的端口被某个程序占用了,或者是avd start的顺序不对。

  我重新启动了一下电脑,打开Eclipse中的MyFirstApp 工程,选中 preference-> avd mananger, 启动avd模拟器设备,

再到CMD下面重新启动 adb server.


adb start-server 

看到启动信息在端口5037.

然后点击 Run, 这个android程序终于正常运行。解决问题。

抱歉!评论已关闭.