0

I am creating a companion wearable application for an android application. Both the apps work perfectly and communicate with each other when built as debug apk and signed apk. However, when it is built as android app bundle and distributed through app center internal beta, the extracted/installed wearable apk is not identifying the capability advertised by the mobile app. On analyzing the extracted apk, I found that the wear.xml in res/values directory is missing and as per the developer site, this wear.xml is the key resource that advertises the wearable capability on the wearable data layer. I have also added the 'keep' attribute in the wear.xml to exclude it from the shrink resources during build as follows:

<resources xmlns:tools="http://schemas.android.com/tools"
    tools:keep="@array/android_wear_capabilities">
    <string-array name="android_wear_capabilities"
        tools:ignore="UnusedResources"
        translatable="false">
        <!-- declaring the provided capabilities -->
        <item>CapabilityName</item>
    </string-array>
</resources>

Even then somehow the wear.xml file is removed it seems. What am I missing here? How can I successfully make the android app advertise its capabilities on the wearable data layer when distributed as an app bundle.

Note: We tried to create a distribution without the shrink resources enabled and the distribution worked as expected in this scenario.

1 Answer 1

0

This may solve your issue:

add res/raw/keep.xml to all modules where android_wear_capabilities is needed

Include this in the keep.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
    tools:keep="@array/android_wear_capabilities"/>

Then set isShrinkResources = true

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.