You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bc...@apache.org on 2012/04/04 05:46:55 UTC
docs commit: Updated Android Getting Started guide for 1.6.0.
Updated Branches:
refs/heads/master e9b00f531 -> 1ecd9f220
Updated Android Getting Started guide for 1.6.0.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/1ecd9f22
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/1ecd9f22
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/1ecd9f22
Branch: refs/heads/master
Commit: 1ecd9f220c6813c492443c4f3060d9025f4fcdd4
Parents: e9b00f5
Author: Bryce Curtis <cu...@gmail.com>
Authored: Tue Apr 3 22:46:15 2012 -0500
Committer: Bryce Curtis <cu...@gmail.com>
Committed: Tue Apr 3 22:46:15 2012 -0500
----------------------------------------------------------------------
.../en/edge/guide/getting-started/android/index.md | 66 ++++++++-------
.../guide/getting-started/android/buildPath.jpg | Bin 0 -> 80516 bytes
.../img/guide/getting-started/android/javaSrc.jpg | Bin 420745 -> 141340 bytes
.../img/guide/getting-started/android/manifest.jpg | Bin 247181 -> 268212 bytes
4 files changed, 35 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/1ecd9f22/docs/en/edge/guide/getting-started/android/index.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/guide/getting-started/android/index.md b/docs/en/edge/guide/getting-started/android/index.md
index 9460a42..2ecd2e4 100644
--- a/docs/en/edge/guide/getting-started/android/index.md
+++ b/docs/en/edge/guide/getting-started/android/index.md
@@ -3,51 +3,55 @@ Getting Started with Android
This guide describes how to set up your development environment for Cordova and run a sample application. Note that Cordova used to be called PhoneGap, so some of the sites still use the old PhoneGap name.
-Video Tutorials:
-----------------
-
-- [Cordova and Android Quick Start Video Using Ecliplse](http://www.youtube.com/v/MzcIcyBYJMA?autoplay=1)
-
1. Requirements
---------------
- Eclipse 3.4+
-There is also a [Terminal](http://wiki.phonegap.com/w/page/30864168/phonegap-android-terminal-quickstart) of this tutorial that doesn't use Eclipse.
-
2. Install SDK + Cordova
-----------------------------
+------------------------
- Download and install [Eclipse Classic](http://www.eclipse.org/downloads/)
- Download and install [Android SDK](http://developer.android.com/sdk/index.html)
- Download and install [ADT Plugin](http://developer.android.com/sdk/eclipse-adt.html#installing)
-- Donwload the latest copy of [Cordova](http://phonegap.com/download) and extract its contents. We will be working with the Android directory.
+- Download the latest copy of [Cordova](http://phonegap.com/download) and extract its contents. We will be working with the Android directory.
3. Setup New Project
------------------------
+---------------------
-- Launch Eclipse, then under the menu select **New > Android Project**
+- Launch Eclipse, and select menu item **New > Android Project**. Fill out the three panels of the **New Android Project** wizard shown below.
![](img/guide/getting-started/android/AndroidFlow.png)
-- In the root directory of the project, create two new directories:
+
+- In the root directory of your project, create two new directories:
- **/libs**
- **assets/www**
- Copy **cordova-1.6.0.js** from your Cordova download earlier to **assets/www**
- Copy **cordova-1.6.0.jar** from your Cordova download earlier to **/libs**
- Copy **xml** folder from your Cordova download earlier to **/res**
-- Make a few adjustments too the project's main Java file found in the **src** folder in Eclipse: (view image below)
+
+- Verify that **cordova-1.6.0.jar** is listed in the Build Path for your project. Right click on the /libs folder and go to **Build Paths/ > Configure Build Path...**. Then, in the Libraries tab, add **cordova-1.6.0.jar** to the project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again.
+
+ ![](img/guide/getting-started/android/buildPath.jpg)
+
+- Edit your project's main Java file found in the **src** folder in Eclipse:
+ - Add **import org.apache.cordova.*;**
- Change the class's extend from **Activity** to **DroidGap**
- Replace the **setContentView()** line with **super.loadUrl("file:///android_asset/www/index.html");**
- - Add **import org.apache.cordova.*;**
![](img/guide/getting-started/android/javaSrc.jpg)
-- You might experience an error here, where Eclipse can't find cordova-1.6.0.jar. In this case, right click on the /libs folder and go to Build Paths/ > Configure Build Paths. Then, in the Libraries tab, add cordova-1.6.0.jar to the Project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again.
-- Right click on AndroidManifest.xml and select **Open With > Text Editor**
-- Paste the following permissions under versionName: (view image below)
-
- <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:resizeable="true" android:anyDensity="true" />
+
+- Right click on AndroidManifest.xml and select **Open With > XML Editor**
+- Paste the following permissions between the **<uses-sdk.../>** and **<application.../>** tags.
+
+ <supports-screens
+ android:largeScreens="true"
+ android:normalScreens="true"
+ android:smallScreens="true"
+ android:resizeable="true"
+ android:anyDensity="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
@@ -61,17 +65,22 @@ There is also a [Terminal](http://wiki.phonegap.com/w/page/30864168/phonegap-and
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
-- Add `android:configChanges="orientation|keyboardHidden"` to the activity tag in AndroidManifest. (view image below)
+- Support orientation changes by pasting the folowing inside the **<activity>** tag.
+
+ android:configChanges="orientation|keyboardHidden"
- ![](img/guide/getting-started/android/manifest.jpg)
+- Your AndroidManifest.xml file should look like
+
+ ![](img/guide/getting-started/android/manifest.jpg)
4. Hello World
--------------
-Now create and open a new file named **index.html** in the **assets/www** directory. Paste the following code:
+- Create and open a new file named **index.html** in the **assets/www** directory. Paste the following code:
<!DOCTYPE HTML>
<html>
@@ -83,26 +92,21 @@ Now create and open a new file named **index.html** in the **assets/www** direct
<h1>Hello World</h1>
</body>
</html>
-
- *cordova-1.6.0.js might need to be replaced with latest cordova-<VERSION NUMBER>.js
5A. Deploy to Simulator
-----------------------
-- Right click the project and go to **Run As** and click **Android Application**
+- Right click the project and go to **Run As > Android Application**
- Eclipse will ask you to select an appropriate AVD. If there isn't one, then you'll need to create it.
5B. Deploy to Device
--------------------
-- Make sure USB debugging is enabled on your device and plug it into your system. (Settings > Applications > Development)
-- Right click the project and go to **Run As** and click **Android Application**
+- Make sure USB debugging is enabled on your device and plug it into your system. (**Settings > Applications > Development**)
+- Right click the project and go to **Run As > Android Application**
Done!
-----
-
-You can also checkout more detailed version of this guide [here](http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart).
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/1ecd9f22/template/docs/default/img/guide/getting-started/android/buildPath.jpg
----------------------------------------------------------------------
diff --git a/template/docs/default/img/guide/getting-started/android/buildPath.jpg b/template/docs/default/img/guide/getting-started/android/buildPath.jpg
new file mode 100755
index 0000000..ae3f7ee
Binary files /dev/null and b/template/docs/default/img/guide/getting-started/android/buildPath.jpg differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/1ecd9f22/template/docs/default/img/guide/getting-started/android/javaSrc.jpg
----------------------------------------------------------------------
diff --git a/template/docs/default/img/guide/getting-started/android/javaSrc.jpg b/template/docs/default/img/guide/getting-started/android/javaSrc.jpg
index f35b0da..ab93051 100644
Binary files a/template/docs/default/img/guide/getting-started/android/javaSrc.jpg and b/template/docs/default/img/guide/getting-started/android/javaSrc.jpg differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/1ecd9f22/template/docs/default/img/guide/getting-started/android/manifest.jpg
----------------------------------------------------------------------
diff --git a/template/docs/default/img/guide/getting-started/android/manifest.jpg b/template/docs/default/img/guide/getting-started/android/manifest.jpg
index 1e25330..6039194 100644
Binary files a/template/docs/default/img/guide/getting-started/android/manifest.jpg and b/template/docs/default/img/guide/getting-started/android/manifest.jpg differ