Android Deployment from Eclipse

From HTML5 Builder
Jump to: navigation, search

Warning: You need to setup Eclipse and ADT plug-in first.

This page covers the deployment of mobile applications for Android devices from Eclipse.

Import Your Project

When you build your application from HTML5 Builder, which generates a PhoneGap folder, an Eclipse project file is included in this folder so you can open your project with Eclipse:

  1. Go to File > New > Project... > Android > Android Project, and click Next.
  2. On the next dialog:
    1. Enter a Project Name.
    2. Select Create project from existing source.
    3. On the Location field, use the Browse button to set the path to the PhoneGap folder you exported with HTML5 Builder.
    4. Click Next.
  3. On the next page:
    1. Make sure your desired Android version is checked as Build Target.
    2. Click Finish.

Now you are ready to run your project or just build it.

Run

To run your application, go to Run > Run As > Android Application. Your application will be compiled an launched in either a virtual device or a real device, depending on your Eclipse settings.

Build

Before you build a public version of your application:

  1. Open AndroidManifest.xml file.
  2. Go to Application > Application Attributes.
  3. Set Debuggable attribute to false.
  4. Go to File > Save to save the change.

Now, you will open Export Android Application dialog in order to build your application. Right-click you project folder in Package Explorer and:

  • If you want to sign your application, go to Android Tools > Export Signed Application Package…, and follow these steps.
  • If you do not want to sign your application, go to Android Tools > Export Unsigned Application Package…, and follow these steps.

Warning: Unsigned applications cannot be installed on Android devices. More information in Android Official Documentation.

Signed

  1. On the Export Android Application page, click Next.
  2. On the next page:
    • If you have already a .keystore file to sign your application:
      1. On the first page:
        1. Leave the default choice selected, Use existing keystore.
        2. Click Browse…, go to your .keystore file, select it and click OK.
        3. Type your password in Password field.
        4. Click Next.
      2. On the next page:
        1. Choose an alias.
        2. Type alias’ password in Password field.
        3. Click Next.
    • If you do not have a .keystore file yet:

      Note: .keystore files contain one or several signatures you might use to sign Android applications.

      1. On the first page:
        1. Choose Create new keystore.
        2. Click Browse…, navigate to the location where you want to save your new .keystore file and then click OK.

          Warning: Save your .keystore file in a safe place, you should use it to sign any application you publish.

        3. Type your password in Password field.
        4. Type your password again in Confirmation field.
        5. Click Next.
      2. On the next page:
        1. Fill the form with your data. You need to fill at least these fields: Alias, Password (and Confirm), Validity (25 years is recommended) and First and Last Name.

          Note: This data will be used for the initial signature of your new .keystore file.

        2. Click Next.
  3. On the next page, click Browse…, go to the location where you want to save your application’s .apk file, and click OK.
  4. On the last page, click Finish.

Unsigned

Note: Steps below take place once you have opened Export Android Application dialog.

  1. Choose the location where you want to save your application’s unsigned .apk file.
  2. A warning dialog will pop up to tell you how to sign your application later. Click OK.