Translation: Android Platform guide (Android Platform)

Source: Internet
Author: User
Tags android sdk manager

Android Platform Guide

This guide shows how to build your SDK development environment to deploy Android devices for Cordova applications. Will take you through the entire program including installing the Android SDK, opening an Android project in Eclipsesdk, and deploying it to a simulator or real device. You have to follow this guide at least install the Android SDK, regardless of which workflow you are working on below. ( Web project development and local platform development workflows all require the Android SDK to be installed and accessible via your path)

View more detailed information on the following specified platforms:

    • Android configuration (translated: Android config)
    • Android Webviews (translated: Android Web view)
    • Android Plugins
    • Upgrading Android
    • Android command-line Tools

The above command-line tool (Android command-line tools) refers to the previous version of Cordova3.0, the command-line Interface information about the current interface.

Requirements and Support

Cordova Android requires Android SDK. View system requirements for the Android SDK

Cordova supports Android 2.3.x (flashy, starting from Android API10) and 4.x. According to general rules, in Google's distribution dashboard above when the Android version of the number of users dropped to 5%, then this version will not be Cordova support. The Android version is earlier than API10, and the 3.x version (AP11-13) is less than 5%.

Developers should use a cordova combination of tools and the Android SDK. How to install it look at the command line tool interface, add the project, and then build a project to deploy.

Install the Android SDK from DEVELOPER.ANDROID.COM/SDK. The Android SDK is a distributed ' adt-bundle---' file. On Windows, this adt-bundle is packaged into the installer. On OSX and Linux, just extract ' adt-bundle ' to the place where you store your open tools locally. Here you can find more detailed information about the installation of the Android SDK.

In order to use the Cordova command-line tool, you need to add the SDK tools and platform-tools directories to your PATH environment. In a Mac, you can use a text editor to create or modify a ~/.bash_profile file, and add a code like this, which is where you install the SDK:

Export Path=${path}:/development/adt-bundle/sdk/platform-tools:/development/adt-bundle/sdk/tools

  

The SDK tool is displayed in the new terminal window. Also run the following line to make it available in the current conversation window:

$ source ~/.bash_profile


Modify the PATH environment in Win7:

  • Click the start menu in the lower left corner of the desktop, right click on the computer and click Properties .

  • Click Advanced System Settings on the left

  • In the dialog box that opens, click Environment Variables

  • Select the PATH variable and click Edit .

  • Add the installation location based on your SDK to path last, for example:

     
    ; C:\Development\adt-bundle\sdk\platform-tools; C:\Development\adt-bundle\sdk\tools
     
  • Save and close both dialog boxes.

You may also need to use Java and Ant. Open a command prompt and enter java 和 ant . The following is added to PATH after either failure:

    ;%java_home%\bin;%ant_home%\bin
Open a project in the SDK

Use cordova a new project, as described in the Cordova command line interface. For example, in a source directory:   

    " HelloWorld "     $ cd Hello    $ Cordova Platform Add Android    $ cordova Build

Once created, this is the case if you use the SDK to modify it:

    • Launch the Eclipse application.

    • Select the New Project menu option.

    • From the dialog box that pops up, select Android Project from Existing Code , and then click Next:

    • Put it in the hello directory, or whatever you create the project directory, and then to the platforms/android subdirectory.

    • Click Finish (Finish).

Once the Eclipse window opens, a red X may appear, indicating an unresolved issue. If so, continue with the following steps:

    • Right-click the project directory.

    • In the Properties dialog box, select Androidfrom the navigation panel.

    • For project build goals, select the highest level of Android API you have installed

    • Click OK (complete).

    • From the Project menu , select clean. This should correct all errors in the project.

Deploying to the Emulator

You can cordova run the app in a simulator, or you can run it in Sdkl. In any case, the SDK display must be configured on at least one device. Use Android SDK Manager to configure and run a Java application separately from Eclipse. There are two ways to open it:

    • Run the command at the command line android .

    • From Eclipse, click on the toolbar icon:

Once opened, this Android SDK Manager is like a variety of runtime libraries:

  

  

Select tools→manage AVDs (Android Virtual Devices) and select any item from the Device definitions in this dialog box:

  

Click Create AVD, modify name, then click OK to save the changes:

  

The AVD then appears in the Android Virtual Devices list:

  

Open the emulator as a separate application, select AVD and click Start. It will start on this device and there are some controllable hardware buttons on the device:

  

At this point, you can deploy the application to the emulator at the command line using the following command:

    $ Cordova Emulate Android

 

If you are working in Eclipse, right-click the project and choose Run as→android application. If not you may be asked to make an already open AVD.

For a faster experience, use an Intel processor-based emulator image:

    • Install one or more of the Extras below available Intel x86 Atom System Images andIntel Hardware Accelerated Execution Manager。

    • Run the Intel installation package that extras/intel/Hardware_Accelerated_Execution_Manager 目录 is available in your Android SDK.

    • Create a new AVD based on the target set for Intel image

    • When starting the emulator, make sure there is no error message indicating that the Hax module failed to load

Deploy to real-world devices

Put the app directly on the device, as described in Android Developer site, to make sure that usbdebugging is available, and that the USB connection is plugged into your system.

Use the following command to place the app on the device upstream:

    $ Cordova Run Android
Other options are in Eclipse, right-click on the project and choose Run as→android application.



If there is an inaccurate or incorrect translation, please leave a message.

Translation: Android Platform guide (Android Platform)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.