docs: Add details to Packaging Wearable apps.
Bug: 17943949
(cherry picked from commit 07c9c63e3d)
Change-Id: I765285b7e1a17928778ac161c73b2e48b82b54d6
This commit is contained in:
committed by
Ricardo Cervera-Navarro
parent
1832978cf6
commit
900efcc91c
@@ -29,6 +29,14 @@ Android Studio directly to the wearable is required.</p>
|
|||||||
<p>To properly package a wearable app in Android Studio:</p>
|
<p>To properly package a wearable app in Android Studio:</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
<li>Include all the permissions declared in the manifest file of the wearable app module
|
||||||
|
in the manifest file of the handheld app module. For example, if you specify the {@link
|
||||||
|
android.Manifest.permission#VIBRATE} permission for the wearable app, you must also add that
|
||||||
|
permission to the handheld app.</li>
|
||||||
|
|
||||||
|
<li>Ensure that both the wearable and handheld app modules have the same package name and
|
||||||
|
version number.</li>
|
||||||
|
|
||||||
<li>Declare a Gradle dependency in the handheld app's <code>build.gradle</code> file
|
<li>Declare a Gradle dependency in the handheld app's <code>build.gradle</code> file
|
||||||
that points to the wearable app module:
|
that points to the wearable app module:
|
||||||
<pre>
|
<pre>
|
||||||
@@ -43,39 +51,21 @@ dependencies {
|
|||||||
to specify your release keystore and sign your app. Android Studio exports the signed
|
to specify your release keystore and sign your app. Android Studio exports the signed
|
||||||
handheld app with the wearable app embedded in it automatically into your project's root folder.
|
handheld app with the wearable app embedded in it automatically into your project's root folder.
|
||||||
|
|
||||||
<p>Alternatively, you can create a <code>signingConfig</code> rule in the wearable and handheld
|
<p>Alternatively, you can sign both apps from the command line using the
|
||||||
modules' <code>build.gradle</code> file to sign them with your release key. Both apps must be
|
<a href="{@docRoot}sdk/installing/studio-build.html#gradleWrapper">Gradle wrapper</a>. Both apps
|
||||||
signed to have the automatic pushing of the wearable app work.
|
must be signed to have the automatic pushing of the wearable app work.</p>
|
||||||
|
|
||||||
<pre>
|
<p>Store your key file location and credentials in environment variables and run the Gradle
|
||||||
android {
|
wrapper as follows:</p>
|
||||||
...
|
|
||||||
signingConfigs {
|
<pre class="no-pretty-print">
|
||||||
release {
|
./gradlew assembleRelease \
|
||||||
keyAlias 'myAlias'
|
-Pandroid.injected.signing.store.file=$KEYFILE \
|
||||||
keyPassword 'myPw'
|
-Pandroid.injected.signing.store.password=$STORE_PASSWORD \
|
||||||
storeFile file('path/to/release.keystore')
|
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
|
||||||
storePassword 'myPw'
|
-Pandroid.injected.signing.key.password=$KEY_PASSWORD
|
||||||
}
|
|
||||||
}
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
...
|
|
||||||
signingConfig signingConfigs.release
|
|
||||||
}
|
|
||||||
}
|
|
||||||
...
|
|
||||||
}
|
|
||||||
</pre>
|
</pre>
|
||||||
<p>Build the handheld app by clicking the Gradle button on the right vertical toolbar of
|
</li>
|
||||||
Android Studio and running the <b>assembleRelease</b> task. The task is located under
|
|
||||||
<b>Project name > Handheld module name > assembleRelease</b>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="note"><b>Note:</b>This example embeds the password in your Gradle file, which might be undesirable. See
|
|
||||||
<a href="{@docRoot}sdk/installing/studio-build.html#configureSigning">Configure signing settings</a>
|
|
||||||
for information about how to create an environment variable for the passwords instead.
|
|
||||||
</p>
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<h3>Signing the wearable and handheld app separately</h3>
|
<h3>Signing the wearable and handheld app separately</h3>
|
||||||
@@ -101,6 +91,12 @@ if you are using another IDE or another method of building.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
<li>Include all the permissions declared in the manifest file of the wearable app
|
||||||
|
in the manifest file of the mobile app. For example, if you specify the {@link
|
||||||
|
android.Manifest.permission#VIBRATE} permission for the wearable app, you must also add that
|
||||||
|
permission to the mobile app.</li>
|
||||||
|
<li>Ensure that both the wearable and mobile APKs have the same package name and version
|
||||||
|
number.</li>
|
||||||
<li>Copy the signed wearable app to your handheld project's <code>res/raw</code> directory. We'll
|
<li>Copy the signed wearable app to your handheld project's <code>res/raw</code> directory. We'll
|
||||||
refer to the APK as <code>wearable_app.apk</code>.</li>
|
refer to the APK as <code>wearable_app.apk</code>.</li>
|
||||||
<li>Create a <code>res/xml/wearable_app_desc.xml</code> file that contains the version and
|
<li>Create a <code>res/xml/wearable_app_desc.xml</code> file that contains the version and
|
||||||
|
|||||||
Reference in New Issue
Block a user