Android Deployment from Eclipse
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:
- Go to File > New > Project... > Android > Android Project, and click Next.
- On the next dialog:
- Enter a Project Name.
- Select Create project from existing source.
- On the Location field, use the Browse button to set the path to the PhoneGap folder you exported with HTML5 Builder.
- Click Next.
- On the next page:
- Make sure your desired Android version is checked as Build Target.
- 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:
- Open AndroidManifest.xml file.
- Go to Application > Application Attributes.
- Set Debuggable attribute to false.
- 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
- On the Export Android Application page, click Next.
- On the next page:
- If you have already a .keystore file to sign your application:
- On the first page:
- Leave the default choice selected, Use existing keystore.
- Click Browse…, go to your .keystore file, select it and click OK.
- Type your password in Password field.
- Click Next.
- On the next page:
- Choose an alias.
- Type alias’ password in Password field.
- Click Next.
- On the first page:
- If you do not have a .keystore file yet:
Note: .keystore files contain one or several signatures you might use to sign Android applications.
- On the first page:
- Choose Create new keystore.
- 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.
- Type your password in Password field.
- Type your password again in Confirmation field.
- Click Next.
- On the next page:
- 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.
- Click Next.
- 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.
- On the first page:
- If you have already a .keystore file to sign your application:
- On the next page, click Browse…, go to the location where you want to save your application’s .apk file, and click OK.
- On the last page, click Finish.
Unsigned
Note: Steps below take place once you have opened Export Android Application dialog.
- Choose the location where you want to save your application’s unsigned .apk file.
- A warning dialog will pop up to tell you how to sign your application later. Click OK.