cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject svn commit: r1673862 [6/15] - in /cordova/site: ./ public/docs/en/edge/
Date Wed, 15 Apr 2015 16:43:44 GMT
Modified: cordova/site/public/docs/en/edge/guide_platforms_android_plugin.md.html
URL: http://svn.apache.org/viewvc/cordova/site/public/docs/en/edge/guide_platforms_android_plugin.md.html?rev=1673862&r1=1673861&r2=1673862&view=diff
==============================================================================
--- cordova/site/public/docs/en/edge/guide_platforms_android_plugin.md.html (original)
+++ cordova/site/public/docs/en/edge/guide_platforms_android_plugin.md.html Wed Apr 15 16:43:43
2015
@@ -1,4 +1,3 @@
-<!DOCTYPE html>
 <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
@@ -16,12 +15,14 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
---><html lang="en">
+-->
+
+<!DOCTYPE html>
+<html lang="en">
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
         <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no,
width=device-width">
-        <meta name="generator" content="joDoc">
-<meta name="robots" content="noindex">
+        <meta name="generator" content="joDoc"><meta name="robots" label="noindex">
 
         <title>Apache Cordova API Documentation</title>
 
@@ -40,7 +41,7 @@
 <option value="3.1.0">3.1.0</option>
 </optgroup>
 <optgroup label="English" value="en">
-<option selected value="edge">edge</option>
+<option selected="selected" value="edge">edge</option>
 <option value="4.0.0">4.0.0</option>
 <option value="3.6.0">3.6.0</option>
 <option value="3.5.0">3.5.0</option>
@@ -104,7 +105,9 @@
 <option value="3.1.0">3.1.0</option>
 <option value="2.0.0">2.0.0</option>
 </optgroup>
-<optgroup label="Polish" value="pl"><option value="edge">edge</option></optgroup>
+<optgroup label="Polish" value="pl">
+<option value="edge">edge</option>
+</optgroup>
 <optgroup label="Russian" value="ru">
 <option value="edge">edge</option>
 <option value="3.5.0">3.5.0</option>
@@ -121,21 +124,13 @@
 <option value="3.5.0">3.5.0</option>
 <option value="3.4.0">3.4.0</option>
 <option value="3.1.0">3.1.0</option>
-</optgroup></select>
+</optgroup>
+</select>
             </small>
         </div>
         <div id="subheader">
             <h1>Android Plugins</h1>
-            <small><select><option value="Android%2520Plugins">Android
Plugins</option>
-<option value="Android%20Plugins_plugin_class_mapping">      - Plugin
Class Mapping</option>
-<option value="Android%20Plugins_plugin_initialization_and_lifetime">      -
Plugin Initialization and Lifetime</option>
-<option value="Android%20Plugins_writing_an_android_java_plugin">      -
Writing an Android Java Plugin</option>
-<option value="Android%20Plugins_threading">      - Threading</option>
-<option value="Android%20Plugins_echo_android_plugin_example">      -
Echo Android Plugin Example</option>
-<option value="Android%20Plugins_android_integration">      - Android
Integration</option>
-<option value="Android%20Plugins_debugging_android_plugins">      -

-Debugging Android Plugins
-</option></select></small>
+            <small><select><option value="Android%2520Plugins">Android
Plugins</option><option value="Android%20Plugins_plugin_class_mapping">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Plugin Class Mapping</option><option value="Android%20Plugins_plugin_initialization_and_lifetime">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Plugin Initialization and Lifetime</option><option value="Android%20Plugins_writing_an_android_java_plugin">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Writing an Android Java Plugin</option><option value="Android%20Plugins_threading">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Threading</option><option value="Android%20Plugins_echo_android_plugin_example">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Echo Android Plugin Example</option><option value="Android%20Plugins_android_integration">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Android Integration</option><option value="Android%20Plugins_debugging_android_plugins">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Debugging Android Plugins</option></select
 ></small>
         </div>
 
         <div id="sidebar">
@@ -168,15 +163,13 @@ Debugging Android Plugins
         <div id="scrollable">
             <div id="content">
                 <h1><a name="Android%20Plugins">Android Plugins</a></h1>
-
 <p>This section provides details for how to implement native plugin code
 on the Android platform. Before reading this, see Application Plugins
-for an overview of the plugin's structure and its common JavaScript
+for an overview of the plugin&apos;s structure and its common JavaScript
 interface. This section continues to demonstrate the sample <em>echo</em>
 plugin that communicates from the Cordova webview to the native
 platform and back.  For another sample, see also the comments in
 <a class="external" href="https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java">CordovaPlugin.java</a>.</p>
-
 <p>Android plugins are based on Cordova-Android, which consists of an
 Android WebView with hooks attached to it.  Plugins are represented as
 class mappings in the <code>config.xml</code> file.  A plugin consists of at
@@ -188,93 +181,68 @@ background activity such as media playba
 state should implement the <code>onReset()</code> method as well. It executes
 when the <code>WebView</code> navigates to a new page or refreshes, which reloads
 the JavaScript.</p>
-
-<h2><a name="Android%20Plugins_plugin_class_mapping">Plugin Class Mapping</a></h2>
-
-<p>The plugin's JavaScript interface uses the <code>cordova.exec</code>
method as
+<h2 id="plugin-class-mapping"><a name="Android%20Plugins_plugin_class_mapping">Plugin
Class Mapping</a></h2>
+<p>The plugin&apos;s JavaScript interface uses the <code>cordova.exec</code>
method as
 follows:</p>
-
 <pre class="prettyprint"><code>    exec(&lt;successFunction&gt;, &lt;failFunction&gt;,
&lt;service&gt;, &lt;action&gt;, [&lt;args&gt;]);
-</code></pre>
-
-<p>This marshals a request from the WebView to the Android native side,
+</code></pre><p>This marshals a request from the WebView to the Android
native side,
 effectively calling the <code>action</code> method on the <code>service</code>
class, with
 additional arguments passed in the <code>args</code> array.</p>
-
 <p>Whether you distribute a plugin as Java file or as a <em>jar</em> file
of its
 own, the plugin must be specified in your Cordova-Android
-application's <code>res/xml/config.xml</code> file. See Application Plugins for
+application&apos;s <code>res/xml/config.xml</code> file. See Application
Plugins for
 more information on how to use the <code>plugin.xml</code> file to inject this
 <code>feature</code> element:</p>
-
-<pre class="prettyprint"><code>    &lt;feature name="&lt;service_name&gt;"&gt;
-        &lt;param name="android-package" value="&lt;full_name_including_namespace&gt;"
/&gt;
+<pre class="prettyprint"><code>    &lt;feature name=&quot;&lt;service_name&gt;&quot;&gt;
+        &lt;param name=&quot;android-package&quot; value=&quot;&lt;full_name_including_namespace&gt;&quot;
/&gt;
     &lt;/feature&gt;
-</code></pre>
-
-<p>The service name matches the one used in the JavaScript <code>exec</code>
call.
-The value is the Java class's fully qualified namespace identifier.
+</code></pre><p>The service name matches the one used in the JavaScript
<code>exec</code> call.
+The value is the Java class&apos;s fully qualified namespace identifier.
 Otherwise, the plugin may compile but still be unavailable to Cordova.</p>
-
-<h2><a name="Android%20Plugins_plugin_initialization_and_lifetime">Plugin Initialization
and Lifetime</a></h2>
-
+<h2 id="plugin-initialization-and-lifetime"><a name="Android%20Plugins_plugin_initialization_and_lifetime">Plugin
Initialization and Lifetime</a></h2>
 <p>One instance of a plugin object is created for the life of each
 <code>WebView</code>. Plugins are not instantiated until they are first
 referenced by a call from JavaScript, unless <code>&lt;param&gt;</code>
with an <code>onload</code>
-<code>name</code> attribute is set to <code>"true"</code> in <code>config.xml</code>.
E.g.:</p>
-
-<pre class="prettyprint"><code>&lt;feature name="Echo"&gt;
-    &lt;param name="android-package" value="&lt;full_name_including_namespace&gt;"
/&gt;
-    &lt;param name="onload" value="true" /&gt;
+<code>name</code> attribute is set to <code>&quot;true&quot;</code>
in <code>config.xml</code>. E.g.:</p>
+<pre class="prettyprint"><code>&lt;feature name=&quot;Echo&quot;&gt;
+    &lt;param name=&quot;android-package&quot; value=&quot;&lt;full_name_including_namespace&gt;&quot;
/&gt;
+    &lt;param name=&quot;onload&quot; value=&quot;true&quot; /&gt;
 &lt;/feature&gt;
-</code></pre>
-
-<p>Plugins should use the <code>initialize</code> method for their start-up
logic.</p>
-
+</code></pre><p>Plugins should use the <code>initialize</code>
method for their start-up logic.</p>
 <pre class="prettyprint"><code>@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
     super.initialize(cordova, webView);
     // your init code here
 }
-</code></pre>
-
-<h2><a name="Android%20Plugins_writing_an_android_java_plugin">Writing an Android
Java Plugin</a></h2>
-
+</code></pre><h2 id="writing-an-android-java-plugin"><a name="Android%20Plugins_writing_an_android_java_plugin">Writing
an Android Java Plugin</a></h2>
 <p>A JavaScript call fires off a plugin request to the native side, and
 the corresponding Java plugin is mapped properly in the <code>config.xml</code>
 file, but what does the final Android Java Plugin class look like?
-Whatever is dispatched to the plugin with JavaScript's <code>exec</code> function
-is passed into the plugin class's <code>execute</code> method. Most <code>execute</code>
+Whatever is dispatched to the plugin with JavaScript&apos;s <code>exec</code>
function
+is passed into the plugin class&apos;s <code>execute</code> method. Most
<code>execute</code>
 implementations look like this:</p>
-
 <pre class="prettyprint"><code>    @Override
     public boolean execute(String action, JSONArray args, CallbackContext callbackContext)
throws JSONException {
-        if ("beep".equals(action)) {
+        if (&quot;beep&quot;.equals(action)) {
             this.beep(args.getLong(0));
             callbackContext.success();
             return true;
         }
-        return false;  // Returning false results in a "MethodNotFound" error.
+        return false;  // Returning false results in a &quot;MethodNotFound&quot;
error.
     }
-</code></pre>
-
-<p>The JavaScript <code>exec</code> function's <code>action</code>
parameter corresponds to a
+</code></pre><p>The JavaScript <code>exec</code> function&apos;s
<code>action</code> parameter corresponds to a
 private class method to dispatch with optional parameters.</p>
-
-<p>When catching exceptions and returning errors, it's important for the
-sake of clarity that errors returned to JavaScript match Java's
+<p>When catching exceptions and returning errors, it&apos;s important for the
+sake of clarity that errors returned to JavaScript match Java&apos;s
 exception names as much as possible.</p>
-
-<h2><a name="Android%20Plugins_threading">Threading</a></h2>
-
-<p>The plugin's JavaScript does <em>not</em> run in the main thread of
the
+<h2 id="threading"><a name="Android%20Plugins_threading">Threading</a></h2>
+<p>The plugin&apos;s JavaScript does <em>not</em> run in the main thread
of the
 <code>WebView</code> interface; instead, it runs on the <code>WebCore</code>
thread, as
 does the <code>execute</code> method.  If you need to interact with the user
 interface, you should use the following variation:</p>
-
 <pre class="prettyprint"><code>    @Override
     public boolean execute(String action, JSONArray args, final CallbackContext callbackContext)
throws JSONException {
-        if ("beep".equals(action)) {
+        if (&quot;beep&quot;.equals(action)) {
             final long duration = args.getLong(0);
             cordova.getActivity().runOnUiThread(new Runnable() {
                 public void run() {
@@ -286,14 +254,11 @@ interface, you should use the following
         }
         return false;
     }
-</code></pre>
-
-<p>Use the following if you do not need to run on the main interface's
+</code></pre><p>Use the following if you do not need to run on the main
interface&apos;s
 thread, but do not want to block the <code>WebCore</code> thread either:</p>
-
 <pre class="prettyprint"><code>    @Override
     public boolean execute(String action, JSONArray args, final CallbackContext callbackContext)
throws JSONException {
-        if ("beep".equals(action)) {
+        if (&quot;beep&quot;.equals(action)) {
             final long duration = args.getLong(0);
             cordova.getThreadPool().execute(new Runnable() {
                 public void run() {
@@ -305,26 +270,19 @@ thread, but do not want to block the <co
         }
         return false;
     }
-</code></pre>
-
-<h2><a name="Android%20Plugins_echo_android_plugin_example">Echo Android Plugin
Example</a></h2>
-
-<p>To match the JavaScript interface's <em>echo</em> feature described
in
+</code></pre><h2 id="echo-android-plugin-example"><a name="Android%20Plugins_echo_android_plugin_example">Echo
Android Plugin Example</a></h2>
+<p>To match the JavaScript interface&apos;s <em>echo</em> feature described
in
 Application Plugins, use the <code>plugin.xml</code> to inject a <code>feature</code>
-specification to the local platform's <code>config.xml</code> file:</p>
-
-<pre class="prettyprint"><code>    &lt;platform name="android"&gt;
-        &lt;config-file target="config.xml" parent="/*"&gt;
-            &lt;feature name="Echo"&gt;
-                &lt;param name="android-package" value="org.apache.cordova.plugin.Echo"/&gt;
+specification to the local platform&apos;s <code>config.xml</code> file:</p>
+<pre class="prettyprint"><code>    &lt;platform name=&quot;android&quot;&gt;
+        &lt;config-file target=&quot;config.xml&quot; parent=&quot;/*&quot;&gt;
+            &lt;feature name=&quot;Echo&quot;&gt;
+                &lt;param name=&quot;android-package&quot; value=&quot;org.apache.cordova.plugin.Echo&quot;/&gt;
             &lt;/feature&gt;
         &lt;/config-file&gt;
     &lt;/platform&gt;
-</code></pre>
-
-<p>Then add the following to the
+</code></pre><p>Then add the following to the
 <code>src/org/apache/cordova/plugin/Echo.java</code> file:</p>
-
 <pre class="prettyprint"><code>    package org.apache.cordova.plugin;
 
     import org.apache.cordova.CordovaPlugin;
@@ -341,7 +299,7 @@ specification to the local platform's <c
 
         @Override
         public boolean execute(String action, JSONArray args, CallbackContext callbackContext)
throws JSONException {
-            if (action.equals("echo")) {
+            if (action.equals(&quot;echo&quot;)) {
                 String message = args.getString(0);
                 this.echo(message, callbackContext);
                 return true;
@@ -353,31 +311,26 @@ specification to the local platform's <c
             if (message != null &amp;&amp; message.length() &gt; 0) {
                 callbackContext.success(message);
             } else {
-                callbackContext.error("Expected one non-empty string argument.");
+                callbackContext.error(&quot;Expected one non-empty string argument.&quot;);
             }
         }
     }
-</code></pre>
-
-<p>The necessary imports at the top of the file extends the class from
+</code></pre><p>The necessary imports at the top of the file extends the
class from
 <code>CordovaPlugin</code>, whose <code>execute()</code> method it
overrides to receive
 messages from <code>exec()</code>.  The <code>execute()</code> method
first tests the value
 of <code>action</code>, for which in this case there is only one valid <code>echo</code>
 value.  Any other action returns <code>false</code> and results in an
 <code>INVALID_ACTION</code> error, which translates to an error callback invoked
 on the JavaScript side.</p>
-
-<p>Next, the method retrieves the echo string using the <code>args</code>
object's
+<p>Next, the method retrieves the echo string using the <code>args</code>
object&apos;s
 <code>getString</code> method, specifying the first parameter passed to the
 method.  After the value is passed to a private <code>echo</code> method, it
is
 parameter-checked to make sure it is not <code>null</code> or an empty string,
in
-which case <code>callbackContext.error()</code> invokes JavaScript's error
+which case <code>callbackContext.error()</code> invokes JavaScript&apos;s
error
 callback.  If the various checks pass, the <code>callbackContext.success()</code>
-passes the original <code>message</code> string back to JavaScript's success
+passes the original <code>message</code> string back to JavaScript&apos;s
success
 callback as a parameter.</p>
-
-<h2><a name="Android%20Plugins_android_integration">Android Integration</a></h2>
-
+<h2 id="android-integration"><a name="Android%20Plugins_android_integration">Android
Integration</a></h2>
 <p>Android features an <code>Intent</code> system that allows processes
to
 communicate with each other.  Plugins have access to a
 <code>CordovaInterface</code> object, which can access the Android <code>Activity</code>
@@ -385,16 +338,11 @@ that runs the application.  This is the
 new Android <code>Intent</code>.  The <code>CordovaInterface</code>
allows plugins to start
 an <code>Activity</code> for a result, and to set the callback plugin for when
 the <code>Intent</code> returns to the application.</p>
-
 <p>As of Cordova 2.0, Plugins can no longer directly access the
 <code>Context</code>, and the legacy <code>ctx</code> member is deprecated.
All <code>ctx</code>
 methods exist on the <code>Context</code>, so both <code>getContext()</code>
and
 <code>getActivity()</code> can return the required object.</p>
-
-<h2><a name="Android%20Plugins_debugging_android_plugins">
-Debugging Android Plugins
-</a></h2>
-
+<h2 id="debugging-android-plugins"><a name="Android%20Plugins_debugging_android_plugins">Debugging
Android Plugins</a></h2>
 <p>Eclipse allows you to debug plugins as Java source included in the
 project.  Only the latest version of the Android Developer Tools
 allows you to attach source code to <em>JAR</em> dependencies, so this

Modified: cordova/site/public/docs/en/edge/guide_platforms_android_tools.md.html
URL: http://svn.apache.org/viewvc/cordova/site/public/docs/en/edge/guide_platforms_android_tools.md.html?rev=1673862&r1=1673861&r2=1673862&view=diff
==============================================================================
--- cordova/site/public/docs/en/edge/guide_platforms_android_tools.md.html (original)
+++ cordova/site/public/docs/en/edge/guide_platforms_android_tools.md.html Wed Apr 15 16:43:43
2015
@@ -1,4 +1,3 @@
-<!DOCTYPE html>
 <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
@@ -16,12 +15,14 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
---><html lang="en">
+-->
+
+<!DOCTYPE html>
+<html lang="en">
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
         <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no,
width=device-width">
-        <meta name="generator" content="joDoc">
-<meta name="robots" content="noindex">
+        <meta name="generator" content="joDoc"><meta name="robots" label="noindex">
 
         <title>Apache Cordova API Documentation</title>
 
@@ -40,7 +41,7 @@
 <option value="3.1.0">3.1.0</option>
 </optgroup>
 <optgroup label="English" value="en">
-<option selected value="edge">edge</option>
+<option selected="selected" value="edge">edge</option>
 <option value="4.0.0">4.0.0</option>
 <option value="3.6.0">3.6.0</option>
 <option value="3.5.0">3.5.0</option>
@@ -104,7 +105,9 @@
 <option value="3.1.0">3.1.0</option>
 <option value="2.0.0">2.0.0</option>
 </optgroup>
-<optgroup label="Polish" value="pl"><option value="edge">edge</option></optgroup>
+<optgroup label="Polish" value="pl">
+<option value="edge">edge</option>
+</optgroup>
 <optgroup label="Russian" value="ru">
 <option value="edge">edge</option>
 <option value="3.5.0">3.5.0</option>
@@ -121,19 +124,13 @@
 <option value="3.5.0">3.5.0</option>
 <option value="3.4.0">3.4.0</option>
 <option value="3.1.0">3.1.0</option>
-</optgroup></select>
+</optgroup>
+</select>
             </small>
         </div>
         <div id="subheader">
             <h1>Android Shell Tool Guide</h1>
-            <small><select><option value="Android%2520Shell%2520Tool%2520Guide">Android
Shell Tool Guide</option>
-<option value="Android%20Shell%20Tool%20Guide_create_a_project">      -
Create a Project</option>
-<option value="Android%20Shell%20Tool%20Guide_build">      - Build</option>
-<option value="Android%20Shell%20Tool%20Guide_run_the_app">      -
Run the App</option>
-<option value="Android%20Shell%20Tool%20Guide_logging">      - Logging</option>
-<option value="Android%20Shell%20Tool%20Guide_cleaning">      - Cleaning</option>
-<option value="Android%20Shell%20Tool%20Guide_manual_use_of_ant">      -
Manual Use of Ant</option>
-<option value="Android%20Shell%20Tool%20Guide_building_with_gradle_experimental">      -
Building with Gradle (Experimental!)</option></select></small>
+            <small><select><option value="Android%2520Shell%2520Tool%2520Guide">Android
Shell Tool Guide</option><option value="Android%20Shell%20Tool%20Guide_create_a_project">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Create a Project</option><option value="Android%20Shell%20Tool%20Guide_build">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Build</option><option value="Android%20Shell%20Tool%20Guide_run_the_app">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Run the App</option><option value="Android%20Shell%20Tool%20Guide_signing_the_app">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Signing the App</option><option value="Android%20Shell%20Tool%20Guide_logging">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Logging</option><option value="Android%20Shell%20Tool%20Guide_cleaning">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Cleaning</option><option value="Android%20Shell%20Tool%20Guide_building_with_gradle">&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;-
Building with Gradle</option></select></small>
         </div>
 
         <div id="sidebar">
@@ -166,8 +163,7 @@
         <div id="scrollable">
             <div id="content">
                 <h1><a name="Android%20Shell%20Tool%20Guide">Android Shell Tool
Guide</a></h1>
-
-<p>This guide shows how to use Cordova's set of platform-centered shell
+<p>This guide shows how to use Cordova&apos;s set of platform-centered shell
 tools to develop Android apps. This development path, discussed in the
 <a href="guide_overview_index.md.html#Overview">Overview</a>, may offer you a
greater range of development options than
 the cross-platform CLI tool described in <a href="guide_cli_index.md.html#The%20Command-Line%20Interface">The
Command-Line Interface</a>.
@@ -175,200 +171,149 @@ For example, you need to use shell tools
 Cordova WebView alongside native components.  Before using either
 development path, you must first configure the Android SDK environment
 as described in the <a href="guide_platforms_android_index.md.html#Android%20Platform%20Guide">Android
Platform Guide</a>.</p>
-
 <p>To enable shell tools for Android, download Cordova from
 <a class="external" href="http://cordova.apache.org">cordova.apache.org</a>.
The download contains
 separate archives for each platform. Expand each you wish to target,
 <code>android</code> in this case. The relevant tools are typically available
in
 the top-level <code>bin</code> directory, otherwise consult the <strong>README</strong>
file
 for more detailed directions.</p>
-
 <p>These tools allow you to create, build, and run Android apps.  For
 information on the additional command-line interface that enables
-plugin features across all platforms, see <a href="#Using%20Plugman%20to%20Manage%0APlugins">Using
Plugman to Manage
+plugin features across all platforms, see <a href="plugin_ref_plugman.md.html#Using%20Plugman%20to%20Manage%0APlugins">Using
Plugman to Manage
 Plugins</a>. See Application Plugins for details on how to develop
 plugins.</p>
-
-<h2><a name="Android%20Shell%20Tool%20Guide_create_a_project">Create a Project</a></h2>
-
+<h2 id="create-a-project"><a name="Android%20Shell%20Tool%20Guide_create_a_project">Create
a Project</a></h2>
 <p>Run the <code>create</code> command, specifying the existing path to
the project,
-the reverse-domain-style package identifier, and the app's display
+the reverse-domain-style package identifier, and the app&apos;s display
 name.  Here is the syntax for both Mac/Linux and Windows:</p>
-
 <pre class="prettyprint"><code>    $ /path/to/cordova-android/bin/create /path/to/project
com.example.project_name ProjectName
 
     C:\&gt;\path\to\cordova-android\bin\create.bat \path\to\project com.example.project_name
ProjectName
-</code></pre>
-
-<h2><a name="Android%20Shell%20Tool%20Guide_build">Build</a></h2>
-
+</code></pre><h2 id="build"><a name="Android%20Shell%20Tool%20Guide_build">Build</a></h2>
 <p>This cleans then builds a project.</p>
-
 <p>Debug, on Mac/Linux or Windows:</p>
-
 <pre class="prettyprint"><code>    $ /path/to/project/cordova/build --debug
 
     C:\&gt;\path\to\project\cordova\build.bat --debug
-</code></pre>
-
-<p>Release, on Mac/Linux or Windows:</p>
-
+</code></pre><p>Release, on Mac/Linux or Windows:</p>
 <pre class="prettyprint"><code>    $ /path/to/project/cordova/build --release
 
     C:\&gt;\path\to\project\cordova\build.bat --release
-</code></pre>
-
-<h2><a name="Android%20Shell%20Tool%20Guide_run_the_app">Run the App</a></h2>
-
+</code></pre><h2 id="run-the-app"><a name="Android%20Shell%20Tool%20Guide_run_the_app">Run
the App</a></h2>
 <p>The <code>run</code> command accepts the following <em>optional</em>
parameters:</p>
-
 <ul>
-<li><p>Target specification. This includes <code>--emulator</code>,
<code>--device</code>, or <code>--target=&lt;targetID&gt;</code>.</p></li>
-<li>
-<p>Build specification. This includes <code>--debug</code>, <code>--release</code>,
or <code>--nobuild</code>.</p>
-
+<li><p>Target specification. This includes <code>--emulator</code>,
<code>--device</code>, or <code>--target=&lt;targetID&gt;</code>.</p>
+</li>
+<li><p>Build specification. This includes <code>--debug</code>, <code>--release</code>,
or <code>--nobuild</code>.</p>
 <pre class="prettyprint"><code>$ /path/to/project/cordova/run [Target] [Build]
 
-
 C:\&gt;\path\to\project\cordova\run.bat [Target] [Build]
-</code></pre>
-</li>
+</code></pre></li>
 </ul>
-
 <p>Make sure you create at least one Android Virtual Device, otherwise
-you're prompted to do so with the <code>android</code> command.  If more than
one
-AVD is available as a target, you're prompted to select one. By
+you&apos;re prompted to do so with the <code>android</code> command.  If
more than one
+AVD is available as a target, you&apos;re prompted to select one. By
 default the <code>run</code> command detects a connected device, or a currently
 running emulator if no device is found.</p>
-
-<h2><a name="Android%20Shell%20Tool%20Guide_logging">Logging</a></h2>
-
+<h2 id="signing-the-app"><a name="Android%20Shell%20Tool%20Guide_signing_the_app">Signing
the App</a></h2>
+<p>You can review Android app signing requirements here: <a class="external" href="http://developer.android.com/tools/publishing/app-signing.html">http://developer.android.com/tools/publishing/app-signing.html</a></p>
+<p>To sign an app, you need the following parameters:</p>
+<ul>
+<li>Keystore (<code>--keystore</code>): Path to a binary file which can
hold a set of keys.</li>
+<li>Keystore password (<code>--storePassword</code>): Password to the keystore</li>
+<li>Alias (<code>--alias</code>): The id specifying the private key used
for singing.</li>
+<li>Password (<code>--password</code>): Password for the private key specified.</li>
+<li>Type of the keystore (<code>--keystoreType</code>): pkcs12, jks (Default:
auto-detect based on file extension)
+These parameters can be specified using the command line arguments above to <code>build</code>
or <code>run</code> scripts.</li>
+</ul>
+<p>Alternatively, you could specify them in a build configuration file (build.json)
using (<code>--buildConfig</code>) argument. Here&apos;s a sample of a build
configuration file:</p>
+<pre class="prettyprint"><code>{
+     &quot;android&quot;: {
+         &quot;debug&quot;: {
+             &quot;keystore&quot;: &quot;..\android.keystore&quot;,
+             &quot;storePassword&quot;: &quot;android&quot;,
+             &quot;alias&quot;: &quot;mykey1&quot;,
+             &quot;password&quot; : &quot;password&quot;,
+             &quot;keystoreType&quot;: &quot;&quot;
+         },
+         &quot;release&quot;: {
+             &quot;keystore&quot;: &quot;..\android.keystore&quot;,
+             &quot;storePassword&quot;: &quot;&quot;,
+             &quot;alias&quot;: &quot;mykey2&quot;,
+             &quot;password&quot; : &quot;password&quot;,
+             &quot;keystoreType&quot;: &quot;&quot;
+         }
+     }
+ }
+</code></pre><p>For release signing, passwords can be excluded and the
build system will issue a prompt asking for the password.</p>
+<p>There is also support to mix and match command line arguments and parameters in
build.json file. Values from the comamnd line arguments will get precedence. This can be useful
for specifying passwords on the command line. </p>
+<h2 id="logging"><a name="Android%20Shell%20Tool%20Guide_logging">Logging</a></h2>
 <pre class="prettyprint"><code>    $ /path/to/project/cordova/log
 
     C:\&gt;\path\to\project\cordova\log.bat
-</code></pre>
-
-<h2><a name="Android%20Shell%20Tool%20Guide_cleaning">Cleaning</a></h2>
-
+</code></pre><h2 id="cleaning"><a name="Android%20Shell%20Tool%20Guide_cleaning">Cleaning</a></h2>
 <pre class="prettyprint"><code>    $ /path/to/project/cordova/clean
 
     C:\&gt;\path\to\project\cordova\clean.bat
-</code></pre>
-
-<h2><a name="Android%20Shell%20Tool%20Guide_manual_use_of_ant">Manual Use of
Ant</a></h2>
-
-<p>If you wish to call Ant directly from the command line such as
-<code>ant debug install</code>, you need to specify additional parameters to
the ant
-command:</p>
-
-<pre class="prettyprint"><code>    ant debug install -Dout.dir=ant-build -Dgen.absolute.dir=ant-gen
-</code></pre>
-
-<p>This is because the directories used by Cordova's Ant scripts are different
-than the default. This is done to avoid conflicts when Ant is run from the
-command line versus inside Eclipse/ADT.</p>
-
-<p>These additional parameters are automatically added for you when using
-the <code>cordova/build</code> and <code>cordova/run</code> scripts
described above. For this
-reason it is recommended to use the <code>cordova/build</code> and <code>cordova/run</code>
scripts
-instead of calling Ant directly from the command line.</p>
-
-<h2><a name="Android%20Shell%20Tool%20Guide_building_with_gradle_experimental">Building
with Gradle (Experimental!)</a></h2>
-
-<p>Cordova for Android now supports building with
-<a class="external" href="http://www.gradle.org/">Gradle</a>. This is optional
in Cordova 3.x, but will be
-enabled by default in the future, probably with Cordova 4.0. The build system
-is controlled with environment variables, which can be set for the shell, or
-specified on the command line alongside the <code>cordova build</code> command.</p>
-
-<p>Please note that the Gradle build rules are still in development, and will
-likely be subject to large changes before Gradle becomes the default build
-system. Developers are encouraged to try it, and experiment with it, but if you
-base your own production build system on top of it, you will probably
-experience several breaking changes over the next few releases, before it
-stabilizes.</p>
-
-<h3>Relevant Environment Variables</h3>
-
+</code></pre><h2 id="building-with-gradle"><a name="Android%20Shell%20Tool%20Guide_building_with_gradle">Building
with Gradle</a></h2>
+<p>As of cordova-android@4.0.0, project build using <a class="external" href="http://www.gradle.org/">Gradle</a>.
+For instructions on building with ANT, refer to older versions of documentation.</p>
+<h3 id="gradle-properties">Gradle Properties</h3>
+<p>These <a class="external" href="http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html">properties</a>
+can be set to customize the build:</p>
 <ul>
-<li>
-<p><strong>ANDROID_BUILD</strong></p>
-
-<p>This variable controls which build system is used to build the project. In
-can take either of the values <code>ant</code> or <code>gradle</code>.</p>
-
-<p>If not set, it currently defaults to <code>ant</code>, but this is expected
to change.</p>
-</li>
-<li>
-<p><strong>BUILD_MULTIPLE_APKS</strong></p>
-
+<li><p><strong>cdvBuildMultipleApks</strong> (default: false)</p>
 <p>If this is set, then multiple APK files will be generated: One per native
 platform supported by library projects (x86, ARM, etc). This can be important
 if your project uses large native libraries, which can drastically increase
 the size of the generated APK.</p>
-
 <p>If not set, then a single APK will be generated which can be used on all devices.</p>
 </li>
-<li>
-<p><strong>BUILD_MULTIPLE_APKS</strong></p>
-
-<p>If this is set, then multiple APK files will be generated: One per native
-platform supported by library projects (x86, ARM, etc). This can be important
-if your project uses large native libraries, which can drastically increase
-the size of the generated APK.</p>
-
-<p>If not set, then a single APK will be generated which can be used on all devices.</p>
-</li>
-<li>
-<p><strong>ANDROID_VERSION_CODE</strong></p>
-
+<li><p><strong>cdvVersionCode</strong></p>
 <p>Overrides the versionCode set in <code>AndroidManifest.xml</code></p>
 </li>
-<li>
-<p><strong>RELEASE_SIGNING_PROPERTIES_FILE</strong></p>
-
+<li><p><strong>cdvReleaseSigningPropertiesFile</strong> (default:
release-signing.properties)</p>
 <p>Path to a .properties file that contains signing information for release builds.
-The file should look like:
-<code>
-storeFile=relative/path/to/keystore.p12
+The file should look like:</p>
+<pre class="prettyprint"><code>storeFile=relative/path/to/keystore.p12
 storePassword=SECRET1
 storeType=pkcs12
 keyAlias=DebugSigningKey
 keyPassword=SECRET2
-</code></p>
-
-<p><code>storePassword</code> and <code>keyPassword</code>
are optional, and will be prompted for if omitted.</p>
+</code></pre><p><code>storePassword</code> and <code>keyPassword</code>
are optional, and will be prompted for if omitted.</p>
 </li>
-</ul>
-
-<h3>Other Environment Variables (you don't normally need to set these)</h3>
-
-<ul>
-<li>
-<p><strong>ANDROID_HOME</strong></p>
-
-<p>This should be set to the directory containing the Android SDK.</p>
+<li><p><strong>cdvDebugSigningPropertiesFile</strong> (default: debug-signing.properties)</p>
+<p>Same as cdvReleaseSigningPropertiesFile, but for debug builds. Useful when you need
+to share a signing key with other developers.</p>
 </li>
-<li>
-<p><strong>JAVA_HOME</strong></p>
-
-<p>On some machines, this will need to be set so that Gradle can find the Java
-compiler. On OSX, the value for this variable can be found by running
-<code>/usr/libexec/java_home</code></p>
+<li><p><strong>cdvMinSdkVersion</strong></p>
+<p>Overrides the value of <code>minSdkVersion</code> set in <code>AndroidManifest.xml</code>.
Useful when
+creating multiple APKs based on SDK version.</p>
+</li>
+<li><p><strong>cdvBuildToolsVersion</strong></p>
+<p>Override the automatically detected <code>android.buildToolsVersion</code>
value.</p>
+</li>
+<li><p><strong>cdvCompileSdkVersion</strong></p>
+<p>Override the automatically detected <code>android.compileSdkVersion</code>
value.</p>
 </li>
 </ul>
-
-<h3>Extending build.gradle</h3>
-
+<h3 id="extending-build-gradle">Extending build.gradle</h3>
 <p>If you need to customize <code>build.gradle</code>, rather than edit
directly, you should create
 a sibling file named <code>build-extras.gradle</code>. This file will be included
by the main
-<code>build.gradle</code> when present.</p>
-
-<h3>Example Build</h3>
-
-<pre class="prettyprint"><code>    ANDROID_BUILD=gradle cordova build android
+<code>build.gradle</code> when present. Here&apos;s an example:</p>
+<pre class="prettyprint"><code># Example build-extras.gradle
+# This file is included at the beginning of `build.gradle`
+ext.cdvDebugSigningPropertiesFile = &apos;../../android-debug-keys.properties&apos;
+# When set, this function allows code to run at the end of `build.gradle`
+ext.postBuildExtras = {
+    android.buildTypes.debug.applicationIdSuffix = &apos;.debug&apos;
+}
+</code></pre><p>Note that plugins can also include <code>build-extras.gradle</code>
files via:</p>
+<pre class="prettyprint"><code>&lt;framework src=&quot;some.gradle&quot;
custom=&quot;true&quot; type=&quot;gradleReference&quot; /&gt;
+</code></pre><h3 id="example-build">Example Build</h3>
+<pre class="prettyprint"><code>export ORG_GRADLE_PROJECT_cdvMinSdkVersion=14
+cordova build android -- --gradleArg=-PcdvBuildMultipleApks=true
 </code></pre>
-
             </div>
         </div>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message