锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / 安卓开发起步
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。


安卓开发起步


Learning how to build a mobile application is a good project to improve your programming skills while learning to work in a different environment than the desktop or a web browser. You can get started without worrying about a large stack, making it easy for a beginner to pick it up and start playing with quickly.

Building applications with the Android SDK is self-contained if you stick with the standard libraries. You only need to download the package from Google containing all the tools and you’re ready to go. If you know object-oriented programming and how layouts are done for the web, many patterns and practices will feel familiar to you. The barrier to entry is low: all the tools are free, so you only need an Android device and your computer to get started.

Also, the open philosophy of Android means that you can do as you wish with your applications and your device. As long as you have an installer file (.apk), you can distribute your application to any device. It’s easy to send a copy of your application to your friends so they can test it out. This is great if you have a small project that you only want to deploy on a few machines such as a kiosk an art project. Once you have more experience, there are many open source libraries that improve on what is available in the SDK, and the open source community is active and welcoming.

The following will teach you how to get up and running with the samples included with the Android SDK.

学习如何构建移动应用程序是一个很好的学习方向,可以提高您的编程技能,能学习在不同于桌面或Web浏览器的环境中工作。你可以开始而不用担心大堆栈,让初学者很容易拿起并快速开始玩。

如果您坚持使用标准库,使用Android SDK构建应用程序是独立的。您只需要从Google下载包含所有工具的软件包,您就可以开始使用了。如果您了解面向对象的编程以及如何为Web完成布局,那么您会感觉很熟悉许多模式和实践。进入门槛很低:所有工具都是免费的,因此您只需要Android设备和计算机即可开始使用。

此外,Android的开放理念意味着您可以按照自己的意愿使用应用程序和设备。只要您有安装程序文件(.apk),就可以将应用程序分发到任何设备。您可以轻松地将您的应用程序副本发送给您的朋友,以便他们可以对其进行测试。如果你有一个小项目,你只想部署在一些机器上,例如自助服务终端和艺术项目,那就太棒了。一旦您获得了更多经验,就会有许多开源库可以改进SDK中的可用内容,并且开源社区是活跃且热情的。

以下内容将教您如何使用Android SDK附带的示例,学习如何启动和运行。

Setting Up An Android Development Environment设置Android开发环境

You don’t need much to get started with Android. Any decent PC, Mac or Linux box will do the job. All the tools are free, and you can install them as a single package from the Google Android Developers site at https://developer.android.com/sdk/.

There are two main tools you need to know about: the Android SDK Manager and the Android Studio IDE.

The Android SDK Manager is used to download the libraries, tools, system images and code samples for the platform (version) of the Android OS you want to develop for. By default, the package contains the latest version of the SDK Platform (6.0/API level 23 as I’m writing this). When a new version comes out or a new developer kit is available, you must download it using the SDK Manager.

The Android Studio IDE is where you’re going to spend most of your time. It is based on IntelliJ and includes a code editor, a layout editor and all the tools you need to compile your application and debug it on an emulator or on your Android device. Eclipse was previously available as an IDE so you’re going to see some references to it online, but Android Studio is now the official IDE for Android and everybody is now using it.

开始使用Android并不需要太多。任何体面的PC,Mac或Linux机器都可以完成这项任务。所有工具都是免费的,您可以从Google Android开发者网站https://developer.android.com/sdk/将它们作为单个软件包安装。

您需要了解两个主要工具:Android SDK ManagerAndroid Studio IDE。

Android的SDK管理器,用于下载库,工具,系统映像和代码示例您要开发Android操作系统平台(版本)。默认情况下,该软件包包含最新版本的SDK平台(6.0 / API级别23,因为我正在写这篇文章)。当新版本发布或新的开发人员工具包可用时,您必须使用SDK Manager下载它。

Android Studio中的IDE是你要去的地方度过大部分时间。它基于IntelliJ,包括代码编辑器,布局编辑器以及编译应用程序并在模拟器或Android设备上进行调试所需的所有工具。Eclipse以前作为IDE提供,因此您将在线看到一些对它的引用,但Android Studio现在是Android的官方IDE,现在每个人都在使用它。

Installing the Drivers for Your Tablet安装平板电脑的驱动程序

By default, when you plug in an Android device in your computer, you’ll see the content of the external storage like you would see the content of a USB key. It’s enough to upload data, but if you want to debug an application on your device, you must install the drivers. You could develop applications using the emulator, but it’s a lot slower and it’s going to be hard to see if the touch interactions work as you intended.

If you have a Nexus device, the drivers are available from the Android SDK Manager. For other manufacturers like Samsung or ASUS, you can find the driver on their website. It’s not always clear what you should download, since the driver is often packaged with other software such as synchronization tools.

To be able to attach a debugger, you must also enable the debugging mode on your device by navigating to the About option in the Settings menu. Click 10 times on About and the Developers Options menu will appear, allowing you to set the debugging mode.

默认情况下,当您在计算机中插入Android设备时,您将看到外部存储的内容,就像您将看到USB密钥的内容一样。它足以上传数据,但如果要在设备上调试应用程序,则必须安装驱动程序。您可以使用模拟器开发应用程序,但速度要慢得多,并且很难看出触摸交互是否按预期工作。

如果您有Nexus设备,则可以从Android SDK Manager获取驱动程序。对于三星或华硕等其他制造商,您可以在他们的网站上找到该驱动程序。由于驱动程序通常与其他软件(如同步工具)打包在一起,因此并不总是清楚应该下载什么。

要能够连接调试器,还必须通过导航到“ 设置”菜单中的“ 关于”选项,在设备上启用调试模式。在“ 关于”上单击10次,将出现“ 开发人员选项”菜单,允许您设置调试模式。

Running the Sample Projects from the Android SDK从Android SDK运行示例项目

The language used with the Android SDK is Java, but Android has its own virtual machine, Dalvik, that uses a subset of the standard Java classes. Since it’s such a small subset of Java, you don’t need experience in Java to get started. If you have a good basis in any object-oriented language, you should be able to pick it up pretty fast. The rest of the files, such as language files and layouts, are in XML.

To get started quickly, I’m going to show you how to run one of the sample projects. Those samples are from Google and they are a good starting point to learn what you can do in an Android application and how to do it. Google regularly adds new samples as new APIs becomes available, so check them before trying to do something.

When you start Android Studio for the first time, you’ll see the following screen. To get started running an application right now, just select Import an Android code sample to create a project.

Android SDK使用的语言是Java,但Android有自己的虚拟机Dalvik,它使用标准Java类的子集。由于它是Java的一小部分,因此您无需使用Java经验即可开始使用。如果你有任何面向对象语言的良好基础,你应该能够快速地获取它。其余文件(如语言文件和布局)采用XML格式。

为了快速入门,我将向您展示如何运行其中一个示例项目。这些示例来自Google,它们是了解您在Android应用程序中可以执行的操作以及如何操作的良好起点。随着新API的推出,Google会定期添加新样本,因此在尝试执行某些操作之前请先检查它们。

当您第一次启动Android Studio时,您将看到以下屏幕。要立即开始运行应用程序,只需选择导入Android代码示例即可创建项目。


安卓Studio创建项目

In the following screen, choose the Borderless button example and click Next to create the project:在以下屏幕中,选择Borderless按钮示例,然后单击Next以创建项目:

安卓Studio项目向导

Once the project is loaded, select Debug… from the Run menu to launch the application in debugging mode on your device. A Device Chooser window will pop up, allowing you to select your device (if the driver has been properly installed) or to launch the emulator. Press OK and the sample will run on your device.

You can now play with the sample and add breakpoints in the source code (located in the Application\src\ folder) to see how it behaves. For example, you can put a breakpoint in the onCreate method of the MainActivity.js file, and try to understand how it behaves when you rotate your device.

加载项目后,从“ 运行”菜单中选择“ 调试... ”,以便在设备上以调试模式启动应用程序。一个设备选择器窗口会弹出,让你选择你的设备(如驱动程序已正确安装),或启动模拟器。按OK,样品将在您的设备上运行。

您现在可以使用示例并在源代码(位于Application \ src \文件夹中)中添加断点以查看其行为方式。例如,您可以在MainActivity.js文件的onCreate方法中放置断点,并尝试了解旋转设备时的行为方式。

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内