[PR] Google announces work around to enable paid apps on Android Wear
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 as wearable_app.
- Create a res/xml/wearable_app_desc.xml file that contains the version and path information of the wearable app:
<wearableApp package="com.google.android.wearable.myapp"> <versionCode>1</versionCode"> <versionName>1.0</versionName"> <rawPathResId>wearable_app</rawPathResId"> </wearableApp>
The package, versionCode, and versionName are the same as values specified in the wearable app’s AndroidManifest.xml file. The rawPathResId is the static variable name of the resource. If the filename of your resource is wearable_app.apk, the static variable name would be wearable_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.myapp" 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 intores/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.