ubuntu9.04上android SDK and NDK 安裝與配置

來源:互聯網
上載者:User

1.下載android sdk
如下:
http://dl.google.com/android/android-sdk-windows-1.5_r2.zip
http://dl.google.com/android/android-sdk-linux_x86-1.5_r2.zip
2.下載eclipse 3.4.2
 按官方文檔說,android sdk 可以運行在eclipse 3.3以上的IDE中,ubuntu源中的eclipse版本過低,建議使用eclipse 3.4.2,其為:
http://download.actuatechina.com/eclipse/eclipse/downloads/drops/R-3.4.2-200902111700/eclipse-SDK-3.4.2-linux-gtk.tar.gz
3.安裝eclipse 3.4.2
先將eclipse解壓:
$tar xzvf eclipse-SDK-3.4.2-linux-gtk.tar.gz
 將解壓出的eclipse檔案夾移動到目標目錄中去,在這裡我設定的安裝目標為:/usr/local下。
$sudo mv eclipse /usr/local/
4.安裝android sdk
解壓android sdk包:
$unzip android-sdk-linux_x86-1.5_r2.zip
移動到目標目錄:<在這裡我將解壓出的sdk檔案夾目錄改成了android-sdk>
$mv android-sdk-linux_x86-1.5_r2 android-sdk
$sudo mv android-sdk /usr/local/
5.配置環境變數:
修改~/.bashrc檔案,加入android sdk與eclipse的環境變數。
$vi ~/.bashrc
在檔案的最後加入
export PATH=/usr/local/android-sdk/tools:/usr/local/eclipse:$PATH
儲存並退出vi
使配置資訊生效
$source ~/.bashrc
6.android avd配置資訊的產生
android avd的建立格式為:android create avd -n your-avd-name -t your-targets
其中:-n的參數為我們要建立的avd的名字;-t的參數為Available Android targets的id,我們可以使用命令:android list查尋其具體資訊。
$android list

Available Android targets:
id: 1
     Name: Android 1.1
     Type: Platform
     API level: 2
     Skins: HVGA-P, HVGA (default), QVGA-P, HVGA-L, QVGA-L
id: 2
     Name: Android 1.5
     Type: Platform
     API level: 3
     Skins: HVGA-P, HVGA (default), QVGA-P, HVGA-L, QVGA-L
id: 3
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Description: Android + Google APIs
     Based on Android 1.5 (API level 3)
     Libraries:
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: QVGA-P, HVGA-L, HVGA (default), QVGA-L, HVGA-P
Available Android Virtual Devices:

下面我們就以建立一個android 1.5的avd為例:

$android create avd -n android-sdk-15 -t 2

Android 1.5 is a basic Android platform.
Do you wish to create a custom hardware profile [no]yes

Device ram size: The amount of physical RAM on the device, in megabytes.
hw.ramSize [96]:128

Touch-screen support: Whether there is a touch screen or not on the device.
hw.touchScreen [yes]:yes

Track-ball support: Whether there is a trackball on the device.
hw.trackBall [yes]:yes

Keyboard support: Whether the device has a QWERTY keyboard.
hw.keyboard [yes]:yes

DPad support: Whether the device has DPad keys
hw.dPad [yes]:yes

GSM modem support: Whether there is a GSM modem in the device.
hw.gsmModem [yes]:yes

Camera support: Whether the device has a camera.
hw.camera [no]:

Camera support: Whether the device has a camera.
hw.camera [no]:yes

Maximum horizontal camera pixels
hw.camera.maxHorizontalPixels [640]:854

Maximum vertical camera pixels
hw.camera.maxVerticalPixels [480]:480

GPS support: Whether there is a GPS in the device.
hw.gps [yes]:yes

Battery support: Whether the device can run on a battery.
hw.battery [yes]:yes

Accelerometer: Whether there is an accelerometer in the device.
hw.accelerometer [yes]:yes

Audio recording support: Whether the device can record audio
hw.audioInput [yes]:yes

Audio playback support: Whether the device can play audio
hw.audioOutput [yes]:yes

SD Card support: Whether the device supports insertion/removal of virtual SD Cards.
hw.sdCard [yes]:yes

Cache partition support: Whether we use a /cache partition on the device.
disk.cachePartition [yes]:yes

Cache partition size
disk.cachePartition.size [66MB]:100MB

Created AVD ''android-sdk-15'' based on Android 1.5

這樣我們就建立了一個基於1.5的avd,上面的具體意思我想大家都能看懂,就不多說了。下在我們就可以測試一下android emulator了:

$emulator @android-sdk-15 -show-kernel

這樣就可以啟動android emulator了:


加入參數-show-kernel是為了在終端上列印android kernel的資訊。

下面我們配置eclipse,使之支援android sdk:

開啟Eclipse,Help->Software Updates->Available Software,點擊
Add site,輸入
http://dl-ssl.google.com/android/eclipse/

然後安裝。完成後就可以開始在eclipse上建立android應用程式了。

參照:http://blog.mcuol.com/User/weishuangbo/Article/13320_1.htm

 

If you still cannot install ADT plugin and encounter the error message like this:
"
Cannot complete the install because one or more required items could
> not be found.
>   Software
being installed: Android Development Tools
> 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group
> 0.9.5.v200911191123-20404)
>   Missing requirement: Android Development Tools
> 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group
> 0.9.5.v200911191123-20404) requires 'org.eclipse.wst.xml.ui 0.0.0' but
> it could not be found
"
there may be miss some plugins in your eclipse
1. Go to "Help/Install New Software...
2. Add http://download.eclipse.org/releases/galileo/ to the update sites list(strange it's not installed by default on ubuntu)
3. From there, install WST (use the filter box to find the package)
4. Restart eclipse
5. Go back to "Help/Install New Software..." and install the Android ADT as explained on the android website.

OK, till here you may have a breath, an Android SDK with Eclipse IDE has been successfully installed in you Ubuntu system.
參照:http://blog.chinaunix.net/u3/104357/showart_2132259.html

 

Linux安裝Android SDK時出現Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml

在Linux上面和Window上安裝Android AVD Manager存在著一些差異:

 Linux可切換到android sdk/tools目錄下,執行android

1. $ cd ~/***/android-sdk/tools

2. $ android               //就可開啟android AVD manager

 

今天在ubuntu下使用AVD manager安裝Android SDK2.0時,出現:
Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml
按照提示,勾選了settings裡面的:
Force https://... sources to be fetched using http://...,
並且點擊了save&Apply,但是依舊提示:
Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml
應該時設定的Force的功能沒起作用,在網上搜了以下,有很多人遇到了類似的問題,Android官方也還沒有提出解決方案,但是在Google Group中找到了一種方法(參見:http://groups.google.com/group/android-developers /browse_thread/thread/63a44163a8d07cd9?pli=1):
可以在執行android update sdk前,先在命令列中設定一個環境變數:
export GDK_NATIVE_WINDOWS=true
然後在執行android update sdk,設定Force https://... sources to be fetched using http://...,點擊Save&Apply,就可以了。
其實我後來發現,不用設定什麼環境變數也可以,出現上述問題的主要原因是,勾選了Force……之後,用滑鼠點擊Save&Apply按鈕,沒起作用,應該是UI對單擊事件沒響應,有很簡單的方法就是,用斷行符號,因為勾選完,預設的選項按鈕就是Save&Apply,直接斷行符號就可以了,如果不是預設按鈕,可以先用滑鼠點一下,使其變為當前選中按鈕,然後斷行符號就可以了

refer to : http://blog.csdn.net/JiangBo_HIT/archive/2009/11/24/4860996.aspx

 

after some effort, ah, finally can run hello android, congratulate you!

 

 

 

 

Ubuntu 10.04安裝android NDK

1、下載NDK包,:

http://www.ideasandroid.com/android/sdk/android-ndk-r4-linux-x86.zip

http://dl.google.com/android/ndk/android-ndk-r4b-linux-x86.zip

2、解壓,我們這裡將解壓到/home/ideasandroid/dev/目錄下。

解壓後目錄結構為:/home/ideasandroid/dev/android-ndk-r4


3、配置path路徑(此步也可以省略,只是以後命令要加上路徑/home/myleft/android-ndk-r4b/ndk-build):

命令列執行sudo gedit /etc/profile,在檔案末尾加入如下內容:

#set NDK env

NDKROOT=/home/myleft/android-ndk-r4b

export PATH=$NDKROOT:$PATH

儲存後,重啟機器。至此 android NDK 安裝完畢。

4、編譯sample工程:

執行命令 cd /home/myleft/android-ndk-r4b/samples/hello-jni 進入樣本項目根目錄,然後執行如下命令:

ndk-build

您將看到系統會編譯出libhello-jni.so

至此樣本項目編譯完成,可將hello-jni項目匯入ADT進行進一步的測試。

http://love.myleft.org/home.php?mod=space&uid=21&do=blog&id=601

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.