Update (8 September 2014): All of the issues in the post below have now been resolved in Android Studio 0.8.3 onwards, released on 21 July 2014. The gradle wearApp rule, and the packaging documentation, were updated to use res/raw. The instructions on this blog post remain correct and you can continue to use manual packaging if you want. You can upload Android Wear paid apps to the Google Play using the standard release wearApp release mechanism.
We have a workaround to enable paid apps (and other apps that use Google Play's forward-lock mechanism) on Android Wear. The assets/
directory of those apps, which contains the wearable APK, cannot be extracted or read by the wearable installer. The workaround is to place the wearable APK in the res/raw
directory instead.
As per the documentation, there are two ways to package your wearable app: use the �wearApp�
Gradle rule to package your wearable app or manually package the wearable app. For paid apps, the workaround is to manually package your apps with the following two changes, and you cannot use the �wearApp�
Gradle rule. To manually package the wearable APK into res/raw
, do the following:
- Copy the signed wearable app into your handheld project's
res/raw
directory and rename it to wearable_app.apk, it will be referred to aswearable_app
. - Create a
res/xml/wearable_app_desc.xml
file that contains the version and path information of the wearable app:<wearableApp package="wearable app package name">
<versionCode>1</versionCode>
<versionName>1.0</versionName>
<rawPathResId>wearable_app</rawPathResId>
</wearableApp>The
package
,versionCode
, andversionName
are the same as values specified in the wearable app's AndroidManifest.xml file. TherawPathResId
is the static variable name of the resource. If the filename of your resource is wearable_app.apk, the static variable name would bewearable_app
. - Add a
<meta-data>
tag to your handheld app's<application>
tag to reference the wearable_app_desc.xml file.<meta-data android:name="com.google.android.wearable.beta.app"
android:resource="@xml/wearable_app_desc"/> - Build and sign the handheld app.
We will be updating the �wearApp�
Gradle rule in a future update to the Android SDK build tools to support APK embedding into res/raw
. In the meantime, for paid apps you will need to follow the manual steps outlined above. We will be also be updating the documentation to reflect the above workaround. We're working to make this easier for you in the future, and we apologize for the inconvenience.
No comments:
Post a Comment