在 Ubuntu 14.04 LTS 64 位上使用 eclipse 设置 android sdk 的综合指南

在 Ubuntu 14.04 LTS 64 位上使用 eclipse 设置 android sdk 的综合指南

几周前我才开始使用 Ubuntu,设置好 Ubuntu 后,我的第一步就是设置 Eclipse 进行 Android 开发。我对 Linux 一无所知。我在 Google 和这个网站上搜索了全面的指南。大多数指南都是针对旧版本的 Ubuntu,大多数说明对我来说都不起作用。由于我对 Linux 不是很熟悉,所以我经常不得不从 Ubuntu 的全新副本重新开始。我找到了这个指导最终使得我的 Android 开发得以顺利进行。

希望它也能帮助其他用户。

答案1

以下是在 ubuntu 14.04 上设置 android SDK 的步骤:

# ++++++++++++++++++++++++++++++
# apt-get update and upgrade
# ++++++++++++++++++++++++++++++
sudo apt-get update
sudo apt-get upgrade

# ++++++++++++++++++++++++++++++
# For development
# ++++++++++++++++++++++++++++++
sudo apt-get install build-essential

# ++++++++++++++++++++++++++++++
# Git
# ++++++++++++++++++++++++++++++
sudo apt-get install git
git --version
#git version 1.9.1

# ++++++++++++++++++++++++++++++
#  (required for adb)
# ++++++++++++++++++++++++++++++
#bash: /usr/local/android-sdk-linux/platform-tools/adb: No such file or directory
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
#adb: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
sudo apt-get install g++-multilib

# ++++++++++++++++++++++++++++++
# Android SDK
# ++++++++++++++++++++++++++++++
# http://developer.android.com/sdk/index.html
# DOWNLOAD FOR OTHER PLATFORMS - SDK Tools Only - Linux 32 & 64-bit
# android-sdk_r22.6.2-linux.tgz
tar zxvf android-sdk_r22.6.2-linux.tgz
mv android-sdk-linux android-sdk_r22.6.2-linux
sudo mv android-sdk_r22.6.2-linux /usr/local/
sudo ln -s /usr/local/android-sdk_r22.6.2-linux /usr/local/android-sdk-linux
echo '' >> ~/.profile
echo '# Android SDK' >> ~/.profile
echo 'export ANDROID_SDK_HOME="/usr/local/android-sdk-linux"' >> ~/.profile
echo 'export PATH="$PATH:$ANDROID_SDK_HOME/tools"' >> ~/.profile
echo 'export PATH="$PATH:$ANDROID_SDK_HOME/platform-tools"' >> ~/.profile
source ~/.profile

# ++++++++++++++++++++++++++++++
# Android NDK
# ++++++++++++++++++++++++++++++
# https://developer.android.com/tools/sdk/ndk/index.html
# Linux 64-bit (x86)
# android-ndk-r9d-linux-x86_64.tar.bz2
tar xjvf android-ndk-r9d-linux-x86_64.tar.bz2
mv android-ndk-r9d android-ndk-r9d-linux-x86_64
sudo mv android-ndk-r9d-linux-x86_64 /usr/local/
sudo ln -s /usr/local/android-ndk-r9d-linux-x86_64 /usr/local/android-ndk-linux
echo '' >> ~/.profile
echo '# Android NDK' >> ~/.profile
echo 'export ANDROID_NDK_HOME="/usr/local/android-ndk-linux"' >> ~/.profile
echo 'export PATH="$PATH:$ANDROID_NDK_HOME"' >> ~/.profile
source ~/.profile

# ++++++++++++++++++++++++++++++
# Android w/Eclipse
# ++++++++++++++++++++++++++++++

# Run android command
# android

# Android SDK Manager
#   Installed
#     Tools - Android SDK Tools 22.6.2
#   default checked
#     Tools - Android SDK Platform-tools 19.0.1
#     Tools - Android SDK Build-tools 19.0.3
#     Android 4.4.2 (API 19) All
#     Extras - Android Support Library 19.1
#   install 13 packages

# Eclipse - Help - Install New Software...
#   Name: ADT Plugin
#   Location: https://dl-ssl.google.com/android/eclipse/

#   Developer Tools, NDK Plugins

#   Eclipse restart
#   -> Android SDK "Location of the Android SDK has not been setup in the preferences" -> Close
#   -> Welcome to Android Development -> Use exsting SDKs
#   Existing Location: /usr/local/android-sdk-linux
#   -> Next -> Finish

# Confirm : Eclipse - Window - Preferences - Android

相关内容