5月19日—我的第一篇博客翻译

Get the Android SDK

The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android.

If you're a new Android developer, we recommend you download the ADT Bundle to quickly start developing apps. It includes the essential Android SDK components and a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development.

With a single download, the ADT Bundle includes everything you need to begin developing apps:

获取andriod送我sdk

这个andriod的sdk提供给你api的类库,并且提供了必要的开发工具,去构建,测试,调试应用。

如果你是一个andriod开发的新手,我们推荐你起下载ADT集成环境,去尽快的开始开发应用。它包含了必要的Andriod的sdk组件,和一个版本的Eclipse的IDE,同内置的集成开发环境,去世你的应用更加合理化。

这一次的下载,包括了ADT集成环境包含的你在开发应用时所需的各个工具。

Creating an Android Project

An Android project contains all the files that comprise the source code for your Android app. The Android SDK tools make it easy to start a new Android project with a set of default project directories and files.

This lesson shows how to create a new project either using Eclipse (with the ADT plugin) or using the SDK tools from a command line.

Note: You should already have the Android SDK installed, and if you're using Eclipse, you should also have the ADT plugininstalled (version 21.0.0 or higher). If you don't have these, follow the guide to Installing the Android SDK before you start this lesson.

创建一个andriod开发应用

一个Andriod的项目,包含了所有的文件(项目的原码),android的sdk工具,在一堆缺省的 mulimm

使开发一个项目变得更容易不仅使用了Eclipse(同集成开发环境),通过命令行使用SDK工具。

笔记:你应该已经使用过已经安装过的androidSDK,如果你正在时用Eclipse,你应该有ADT的已安装的插件(版本21.0.0或更高的),如果你不使用这些,在指南的帮助喜爱学习如何安装  Android的SDK在你开始这课之前。

Create a Project with Eclipse


  1. Click New  in the toolbar.
  2. 创建New在工具栏中。
  3. In the window that appears, open the Android folder, select Android Application Project, and click Next.
  4. 在窗体出现的时候,打开android的文件夹,选择android的应用项目并点击下一个。

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

  5. 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.
    • 项目的名称是的项目类库的目录,并且这个名字在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.
    包名对你的应用来说 是包的命名空间(同包在java中的编程语言的规则一样)。你的包名同所有的已安装的包相比必须是独一无二的。因为这个理由
    • 包名通常以你的公司相反的域名开始。对于这个项目,你能够使用一些类似于"com.example.myfirstapp." 这样的例子。但是你不能发表你的应用在google电子市场上在使用"com.example"的命名空间的情况下。

    • 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.
    最低限度的sdk,你的`应用所支持的最低版本的Android,表明使用的API版本。尽可能多的支持更多的设备。你应该设置这个的最低版本允许你的应用提供核心功能集。如果你的应用程序的任何特性是可能只在新版本的Android和它不是关键应用程序的核心功能。
    您可以启用该功能只有在版本上运行,支持支持不同的平台版本(如前所述)。离开这个设置为这个项目的默认值。
    • 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.

  6. On the next screen to configure the project, leave the default selections and click Next.
  7. 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.

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

    For this project, select BlankActivity and click Next.

  9. Leave all the details for the activity in their default state and click Finish.

Your Android project is now set up with some default files and you’re ready to begin building the app. Continue to the next lesson.

目标SDK表明最高版本的Android使用API级别(也)在测试您的应用程序。  随着新版本的Android可用时,你应该在新版本上测试你的应用程序和更新这个值以匹配最新的API级别,以利用新的平台特性。  编译的平台你会编译你的应用程序的版本。默认情况下,这是设置为可用的最新版本的Android SDK。(应该是Android 4.1或更高版本,如果你没有这样一个可用的版本,您必须安装一个使用SDK管理器)。你仍然可以构建应用程序来支持旧版本,但设置构建目标到最新版本允许您启用新特性和优化你的应用程序的用户体验最新的设备。  指定Android UI主题风格申请你的应用,你可以离开

Create a Project with Command Line Tools


If you're not using the Eclipse IDE with the ADT plugin, you can instead create your project using the SDK tools from a command line:

  1. Change directories into the Android SDK’s tools/ path.
  2. Execute:
    android list targets

    This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target id. We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.

    If you don't see any targets listed, you need to install some using the Android SDK Manager tool. See Adding Platforms and Packages.

  3. Execute:
    android create project --target <target-id> --name MyFirstApp \
    --path <path-to-workspace>/MyFirstApp --activity MainActivity \
    --package com.example.myfirstapp
    

    Replace <target-id> with an id from the list of targets (from the previous step) and replace <path-to-workspace> with the location in which you want to save your Android projects.

Your Android project is now set up with several default configurations and you’re ready to begin building the app. Continue to the next lesson.

Tip: Add the platform-tools/ as well as the tools/ directory to your PATH environment variable.

  如果你不使用Eclipse IDE的ADT插件,您可以创建您的项目使用SDK工具从命令行: 更改目录的Android SDK工具/路径。  执行:   android目标列表  这个打印列表可用的Android平台,下载SDK。找到你想要的平台对编译你的应用程序。记下目标id。我们建议您选择最高的版本。你仍然可以构建应用程序来支持旧版本,但设置构建目标到最新版本允许你优化你的应用程序的最新设备。  如果你看不到任何上市的目标,你需要安装一些使用Android SDK管理器工具。看到添加平台和包。  执行:  android创建项目——目标< target-id >名称MyFirstApp \   ——路径< path-to-workspace > / MyFirstApp MainAc活动。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值