Android 简明教程
Android - Environment Setup
您会很高兴知道您可以在以下某个操作系统上启动 Android 应用程序的开发 −
You will be glad to know that you can start your Android application development on either of the following operating systems −
-
Microsoft Windows XP or later version.
-
Mac OS X 10.5.8 or later version with Intel chip.
-
Linux including GNU C Library 2.7 or later.
第二点是,开发 Android 应用程序所需的所有工具均可免费获得且可从 Web 下载。以下是您在开始 Android 应用程序编程之前所需的软件列表。
Second point is that all the required tools to develop Android applications are freely available and can be downloaded from the Web. Following is the list of software’s you will need before you start your Android application programming.
-
Java JDK5 or later version
-
Android Studio
最后两个组件是可选的,如果你使用的是 Windows 机器,那么这两个组件在进行基于 Java 的应用程序开发时会让你的生活更容易。让我们来看看如何进行设置所需的环境。
Here last two components are optional and if you are working on Windows machine then these components make your life easy while doing Java based application development. So let us have a look how to proceed to set required environment.
Set-up Java Development Kit (JDK)
你可以从 Oracle 的 Java 网站上下载最新版本的 Java JDK - Java SE Downloads 。在下载的文件中你会找到安装 JDK 的说明,按照给定的说明安装和配置安装程序。最后,将 PATH 和 JAVA_HOME 环境变量设置为你包含 java 和 javac 的目录,通常是 java_install_dir/bin 和 java_install_dir。
You can download the latest version of Java JDK from Oracle’s Java site − Java SE Downloads. You will find instructions for installing JDK in downloaded files, follow the given instructions to install and configure the setup. Finally set PATH and JAVA_HOME environment variables to refer to the directory that contains java and javac, typically java_install_dir/bin and java_install_dir respectively.
如果你运行的是 Windows,并已在 C:\jdk1.8.0_102 中安装了 JDK,则你需要将以下代码放在你的 C:\autoexec.bat 文件中。
If you are running Windows and installed the JDK in C:\jdk1.8.0_102, you would have to put the following line in your C:\autoexec.bat file.
set PATH=C:\jdk1.8.0_102\bin;%PATH%
set JAVA_HOME=C:\jdk1.8.0_102
另外,你也可以右键单击“我的电脑”,选择“属性”,然后选择“高级”,再选择“环境变量”。然后,你需要更新 PATH 值并按 OK 按钮。
Alternatively, you could also right-click on My Computer, select Properties, then Advanced, then Environment Variables. Then, you would update the PATH value and press the OK button.
在 Linux 中,如果 SDK 已安装在 /usr/local/jdk1.8.0_102 中,并且你使用的是 C Shell,那么你需要将以下代码放入你的 .cshrc 文件中。
On Linux, if the SDK is installed in /usr/local/jdk1.8.0_102 and you use the C shell, you would put the following code into your .cshrc file.
setenv PATH /usr/local/jdk1.8.0_102/bin:$PATH
setenv JAVA_HOME /usr/local/jdk1.8.0_102
另外,如果你使用 Android Studio,那么它会自动知道你在哪里安装了 Java。
Alternatively, if you use Android studio, then it will know automatically where you have installed your Java.