001.android环境搭建(集成的IDE搭建开发环境)

来源:互联网 发布:数据安全防护建设方案 编辑:程序博客网 时间:2024/05/17 07:02

课程概要:android环境的搭建主要有以下三步:

1.android SDK的安装

2 .ADT的安装和配置

3.android模拟器的配置

Additional information:

如果你还没有JDK的话,可以去这里下载,接下来的工作就是安装提示一步一步走。设置环境变量步骤如下:(一般做java开发的一般都有了,哈哈,我用的是1.7)

  1. 我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量:
  2. JAVA_HOME值为: D:\Program Files\Java\jdk1.6.0_18(你安装JDK的目录
  3. CLASSPATH值为:.;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\bin;
  4. Path:  在开始追加 %JAVA_HOME%\bin;
  5. NOTE:前面四步设置环境变量对搭建Android开发环境不是必须的,可以跳过。

安装完成之后,可以在检查JDK是否安装成功。打开cmd窗口,输入java –version 查看JDK的版本信息。出现类似下面的画面表示安装成功了:

image

 

原来安装android开发环境,要花几个小时,太纠结了,今天我查看了官方文档,发现了一个文档,原来发布了集成版的,昨天写的文档就全作废了,直接上最新的,最省事的吧,哈哈。经验教训:先看官方文档,再动手去做。不说废话了:点击http://developer.android.com/sdk/index.html#download,下载集成开发包。

1.在上边的链接地址下载adt-bundle-windows-x86-20130219.zip集成开发包

2.解压,打开eclipse/运行eclipse.exe

3.选择 windows -》android SDK Manager -》下载相应的版本。如android2.3的镜像文件;因为我已经安装完了,如下图:下图的安装的时候都得选上。根据自己的需求,下载不同的包。

 

 4.配置模拟器

启动eclipse --》window--》android virtual Device Manager 下面的操作按图走:

 选择 -》New---》按照下面的填写,其中的target这一项不是手动填写,它的版本取决于第三步你所选择的下载版本,我的是android4.2.2(API17)所以target‘这里显示的是android 4.2.2 -API17

5.点击ok --》出现下图:选择refresh -》在选择start 即可

6.新建一个工程(和老版本的没有区别)

这里引用官方文档的步骤:

  1. Click New  in the toolbar.(or File -》new-》android Application project)
  2. In the window that appears, open the Android folder, select Android Application Project, and click Next.

    Figure 1. The New Android App Project wizard in Eclipse.

  3. Fill in the form that appears:
    • Application Name is the app name that appears to users. For this project, use "My First App."

    • Project Name is the name of your project directory and the name visible in Eclipse.
    • Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organization or publisher entity. For this project, you can use something like "com.example.myfirstapp." However, you cannot publish your app on Google Play using the "com.example" namespace.
    • Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions). Leave this set to the default value for this project.
    • Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application.

      As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level in order to take advantage of new platform features.

    • Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager). You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
    • Theme specifies the Android UI style to apply for your app. You can leave this alone.

    Click Next.

  4. On the next screen to configure the project, leave the default selections and click Next.
  5. The next screen can help you create a launcher icon for your app.

    You can customize an icon in several ways and the tool generates an icon for all screen densities. Before you publish your app, you should be sure your icon meets the specifications defined in the Iconography design guide.

    Click Next.

  6. Now you can select an activity template from which to begin building your app.

    For this project, select BlankActivity and click Next.

  7. Leave all the details for the activity in their default state and click Finish.
  8. run 的方式有两种:第一种:如图

第二种:

9.运行结果:证明环境答对了。