2. Eclipse +android 4.2的第一個應用程式Hello World

來源:互聯網
上載者:User

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程式終於正常運行。解決問題。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.