android sdk bundle,Ubuntu上的Android SDK/ADT Bundle完整安装指南

问题描述

在Ubuntu上安装Android SDK /ADT Bundle需要做什么?

答案中的每个步骤都在一些不同的论坛上发现,因为我遇到了开始使用我的Android SDK的障碍,并在之后的相应论坛中发布了问题。所以我认为这将是有用的,因为它是可用的一站式解决方案,以防万一需要re-install Ubuntu并从头安装Android SDK /ADT Bundle!

最佳解决方法

其实,我认为你应该使用Android Studio开发android应用程序。但是,如果您有使用eclipse的理由,则可以按照以下指南进行操作。

Target : Super Newbies

IDE : Eclipse

Description: Provide a GUI method to install Android IDE using Eclipse

1.安装Java运行时(JDK)和Eclipse IDE

在Ubuntu上搜索Software并启动Ubuntu Software Center

7819c600d49c9b17f1bfe631d51093ff.png

在Ubuntu Software Center上搜索Java,然后安装OpenJDK Java Runtime。

01933479fd4d59cbce4367bc292eb2e4.png

在Ubuntu Software Center上搜索Eclipse,然后进行安装。

7ee7a2721238c21e6f685a97c607542b.png

如果您已成功安装eclipse和JDK,它将出现在计算机上的搜索结果中。

6bf24dcf5a9ede47326a10f972c17afa.png

5fc3d1df82075649b2d8b1a96b5a4da1.png

对于JDK,也可以按CTRL + ALT + T打开一个终端并输入命令java -version再次检查。

1d297ec579101d019c0e0e88494e5660.png

提示:在启动器上锁定eclipse图标。

05ee32989f1f4fa2adf6f0626b7a8672.png

2.下载SDK

向下滚动并单击DOWNLOAD FROM OTHER PLATFORMS

851a981ad67ce4737362695954678d19.png

单击SDK Tools Only Linux 32 & 64-bit下的android-sdk_r22.6.2-linux.tgz。

b1b533e692a3fea08adaea5dd5c7c3dc.png

勾选I have read and agree with the above terms and conditions并单击Download android-sdk_r22.6.2-linux.tgz。

e62d8c342ad53331c3c60fd9bd4b27dd.png

等待下载过程。

14922e325f5af1ee4ae36de7dbfa160e.png

3.准备安装

转到您设置为下载文件的位置。

Rigth单击文件[.tgz]并选择Extract Here。

27ec2a2cdfcbcbfd85c01a6c73536bd3.png

现在您可以看到名为android-sdk-linux的文件如下所示。

f4d4780a8bfffd49277eb7b71d4944b9.png

进入文件夹android-sdk-linux。

cd7e4cde92dde001bef5ad20b615745f.png

输入文件夹tools,然后复制文件夹位置。

edcdf7144a0f91fbe5189306bbfeab78.png

按下CTRL + ALT + T键打开一个终端,然后使用以下命令。 /home/casper/Downloads/android-sdk-linux/tools是我之前复制的位置。您只需键入cd并右键单击以将该位置过滤到终端。

cd /home/casper/Downloads/android-sdk-linux/tools

./android

现在Android SDK Manager将运行。

4.安装软件包

点击Install [Number] packages...。

7b36f38b8b82490804e29a24cfe69aac.png

单击Accept License,然后单击Install。

10399f9b7009867b774201bd3778a426.png

等待安装过程。

bbef3e3722c6987a1f6bbeb7b37e44b7.png

最后,将显示此消息。

bec0d08c4ae28d2508e356ef8ff70701.png

5.编辑”.bashrc”

按CTRL + ALT + T打开一个新终端并键入:gedit ~/.bashrc

0381d69f3bd831803ded6c5e2dd4da1a.png

现在将出现以下文本。

1f58fadb6fd57ad0902cefd76fb92dc3.png

将以下内容添加到整个文本的顶部,然后保存它。 (不要关闭文件)

export PATH=${PATH}:~/android-sdk-linux/tools

export PATH=${PATH}:~/android-sdk-linux/platform-tools

示例:

43dcfe575a8bb0c5db1135b5f5e9529d.png

[推荐]将整个文件android-sdk-linux移动到您的eclipse的工作区,并在您创建的名为Android的文件夹下。而且,你必须复制位置。

15c65043e5f4536362ff5fee5f090403.png

现在回到”.bashrc”文件,并用先前复制的位置替换’~’,然后保存并关闭它。

f84e8d45fe93d771b5710cf1ff699bb7.png

注销并重新登录你的Ubuntu系统。

6.设置Android虚拟设备

按CTRL + ALT + T并键入android avd打开Android虚拟设备管理器。

e90eb551c85f56bf3e31901eae958c49.png

10c31e7d8f4994ff50b28ebab642bff8.png

点击New...。设置如下,然后点击OK。

1b4baa94e9bb2c1fe7d261f6b3aaec15.png

点击你的虚拟设备,然后点击Start...。

5477155f364e35f24bf64f88cc005123.png

点击Launch。

5b4dfe6c25fd01a68a0a8553b5e1fe50.png

启动您的虚拟设备

94eebe0cf564aadc2a70f16e86dea82d.png

7.在Eclipse上安装ADT插件

启动Eclipse并转到Help – > Install New Software...

1908652d37c05341c9dd6822097f51d3.png

点击Add...。

50d4730f2d7f2192bb8bda9e1c140748.png

键入以下内容,然后单击OK。

Name : ADT Plugin

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

选中Developer Tools复选框,然后单击Next>。

9e75965a47833a8892e7afcea078d4cc.png

点击Next>。

101667a04a806931503fb220e1cb5dec.png

点击“我接受…”并点击Finish。

9e34fe8119e492eee787849b084a21c5.png

等待安装过程。

21b08766e83f996de05a6708da55f6d5.png

重新开启eclipse。

d61792e597f91d13ad85952af3bd23b3.png

点击Open Preferences。

f0cd4b704fd09877787edfee5278d6b7.png

复制您自己的SDK位置(文件android-sdk-linux的位置)。

3136e5eb46f14a08113da0a376a1bf9c.png

粘贴到SDK Location:文本框,然后单击Apply和OK。

11b340d41dd3bb8673534eaffe5d624c.png

享受与您的Ubuntu创建任何Android应用程序。

456c5a50aa36aefe6af9bbe42aea05de.png

次佳解决方法

步骤1

Check in System Settings -> Details, whether your Ubuntu is 32-bit or 64-bit

第2步

(Using software centre or command lines) If your Ubuntu is a 32-bit OS then install libgl1-mesa-dev

In case of 64-bit OS install ia32-libs (Ubuntu 13.04 or earlier), or libgl1-mesa-dev:i386 (Ubuntu 13.10 and above)

第3步

Install openjdk-8-jdk. If not compatible try openjdk-7-jdk, or if still not compatible openjdk-6-jdk

步骤4

Download the Android SDK command line tools here (they’re located at the bottom of the page) and unzip it to a place where you can leave it as long as you need the Android SDK, /opt/ for instance.

第5步

Check that the unzipped ADT Bundle folder (or Android SDK folder, as the case may be) have the folders tools and platform-tools. If platform-tools folder is absent, you should be able to install it from the android virtual device manager, which can be run by typing the command

android

in the terminal. These folders contain some important commands stored. Add them to your executable path. Adding them to the path can be done as follows:

First execute gedit ~/.pam_environment. A file opens. Just add these lines to that file:

PATH DEFAULT=${PATH}:/path/to/tools PATH DEFAULT=${PATH}:/path/to/platform-tools

Here you have to replace /path/to/tools and /path/to/platform-tools by the absolute paths according to where you unzipped the SDK or the ADT bundle download. Now all the commands adb, android, emulator etc can be simply executed in the terminal without giving absolute paths. That is, you will not get a “command not found” error if you gave it without its absolute path.

第6步

Type android into the terminal and, if Step 5 was done correctly, the Android SDK Package Tool will start, where you can finish your installation.

第三种解决方法

这似乎是一个很长的答案,但我试图尽可能详细地解释每一步,所以没有什么可以出错。即使作为初学者,您也可以在不到5分钟的时间内完成设置。

您需要Java才能使用Eclipse,因此请先安装它:Eclipse是IDE。 Android ADT软件包默认与Eclipse IDE捆绑在一起。如果您愿意,也可以选择使用其他IDE(例如NetBeans),但由于Eclipse是默认设置,因此本教程仅介绍Eclipse。

打开终端在您的Dash中搜索或按CTRL + ALT + T

b2e86d54adc451be9ba80844d787a148.png

执行以下命令:

sudo apt-get update

sudo apt-get install openjdk-7-jdk

检查您是否在屏幕上看到任何错误,然后继续。

现在下载Android ADT包(这是Eclipse + Android SDK):

点击here进入下载页面。

点击Download the SDK (ADT Bundle for Linux)

检查I have read and agree with the above terms and conditions

如果你有一个32位的Ubuntu,请检查32-bit

如果您使用的是64位Ubuntu,请检查64-bit

点击Download the SDK ADT Bundle for Linux

安装Android ADT软件包:

打开刚刚下载的.zip文件

将所有文件解压缩到一个目录,例如:

~/ADT

解压后,该目录应该包含2个其他目录:

~/ADT/eclipse

~/ADT/sdk

将platform-tools二进制文件添加到您的$PATH:这不是必须的,它会使adb等命令从终端访问。

打开一个终端

执行以下命令:

nano ~/.profile

在顶部添加以下行:

PATH="$HOME/ADT/sdk/platform-tools:$PATH"

保存文件您可以通过按CTRL + X,Y,ENTER

在您的Dash中创建快捷方式以轻松启动ADT:

打开一个终端

执行以下命令

nano ~/.local/share/applications/adt.desktop

粘贴这个:

这可以通过在终端窗口内右键单击来完成,然后单击Paste。

[Desktop Entry]

Version=1.0

Name=Android ADT

Comment=Launch the Android ADT

Exec=/home/username/ADT/eclipse/eclipse

Icon=/home/username/ADT/eclipse/icon.xpm

Terminal=false

Type=Application

Categories=Development;IDE;

注意:用您的用户名替换username。您可以通过在终端中执行whoami来获取用户名。

保存文件

执行以下命令使其可执行:

chmod +x ~/.local/share/applications/adt.desktop

如果你做得对,你现在已经成功安装了Android ADT。打开你的Dash并搜索ADT。点击Android ADT检查它是否正常工作!

第四种方法

您也可以从this PPA安装adt和android-sdk。

sudo add-apt-repository ppa:linuxgndu/adt-raring

sudo apt-get update

sudo apt-get install adt android-sdk

要完成android-sdk的安装,您需要:

sudo sh /opt/android-sdk/install-sdk

您也可以安装android-studio:

sudo apt-get install android-studio

现在检查安装是否按预期进行:

android-sdk-manager

参考资料

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值