Lazy Android document backup 2: Run your app

Source: Internet
Author: User

If you follow the translation in the previous section, you will have a helloworld project.

This article describes how to install an android program device or simulator, which can be implemented by using eclipse and command line ..

Note that these files and directories are missing:

AndroidManifest.xml
This configuration List defines some basic program features and its components ..

 <uses-sdk>Element: You can use
android:minSdkVersionAndandroid:targetSdkVersionAttribute makes your app compatible with different versions.
For example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" ... >    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />    ...</manifest>

Tryandroid:targetSdkVersionSet high point and test well.

src/
Main Program Files
res/
Resource Folder:

drawable-hdpi/
Some image resources can be stored in the assets folder.
layout/
Layout XML file.
values/
For example, color definition and resource index.

This program is simple, but helloworld is the best entry.

Run on a real machine

If you have an Android device, you can install your program as follows:

  1. Connect the USB data cable and install the relevant USB driver.
  2. Enable the debugging mode of the mobile phone.
    • This is enabled in most versions earlier than 3.2.Settings> Applications> Development.
    • 4.0 or moreSettings> developer options.

      Note:This option is hidden by default for more than 4.2.Settings> about phonePoint TimesBuild numberThen you can findDeveloper options.

In eclipse:

  1. Open the project and click Run.Run.
  2. ClickAndroid Application.

Run the following command line:

  1. Change the directory to the project:

    ant debug
  2. Make sure that the android SDKplatform-tools/Directory inPATHEnvironment variables, and then:
    adb install bin/MyFirstApp-debug.apk
  3. Find and run your program.

This is how to run your android program.

Run on Simulator

The simulator AVD is very useful. It can simulate many devices that do not have resolution.

Figure 1. The AVD manager showing a few virtual devices.

Create a simulator AVD:

  1. Open the AVD Manager:

    1. Click here in eclipse.
    2. Enter<sdk>/tools/:
      android avd
  2. ClickNew.
  3. Enter the basic information, such as the name, platform, SD card size, and resolution.
  4. PointCreate AVD.
  5. Select an AVD and start.
  6. Unlock the simulator after running it.

In eclipse, open the app to the simulator:

  1. ClickRun.
  2. InRunSelectAndroid ApplicationClickOK.

The command luggage is installed as follows:

  1. Change the path to the project:

    ant debug
  2. Make sure the SDKplatform-tools/The directory is in yourPATHEnvironment variables:
    adb install bin/MyFirstApp-debug.apk
  3. Find it in the simulator and run it.
Related Article

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.