Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Assistant Android Studio Plugin unable to recognize shortcuts.xml

I'm using Android Studio Chipmunk 2021.2.1 Patch 1. I followed this codelab to implement Google Assistant App Actions. But for some reason, it's giving me the following error, whenever I try to build the app or try to use Google Assistant Android Studio Plugin:-

There are no resources listed in your Android Manifest matching to shortcuts.xml or actions.xml.

Here is my Android manifest file:-

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.devrel.android.fitactions">

    <!-- Needed permission to start the FitTrackingService in foreground mode -->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

    <application
        android:name="com.devrel.android.fitactions.FitApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">
        <meta-data
            android:name="android.app.shortcuts"
            android:resource="@xml/shortcuts" />
        <activity
            android:name="com.devrel.android.fitactions.FitMainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:theme="@style/AppTheme.NoActionBar">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity>

        <service
            android:name="com.devrel.android.fitactions.tracking.FitTrackingService"
            android:enabled="true"
            android:exported="true" />

    </application>

</manifest>

And here is my shortcuts.xml in res/xml folder:-

<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Add Start Exercise intent parameter shortcuts -->
    <shortcut
        android:shortcutId="running"
        android:shortcutShortLabel="@string/activity_running">
        <capability-binding android:key="actions.intent.START_EXERCISE">
            <parameter-binding
                android:key="exercise.name"
                android:value="@array/runningSynonyms" />
        </capability-binding>
    </shortcut>

    <shortcut
        android:shortcutId="walking"
        android:shortcutShortLabel="@string/activity_walking">
        <capability-binding android:key="actions.intent.START_EXERCISE">
            <parameter-binding
                android:key="exercise.name"
                android:value="@array/walkingSynonyms" />
        </capability-binding>
    </shortcut>

    <shortcut
        android:shortcutId="cycling"
        android:shortcutShortLabel="@string/activity_cycling">
        <capability-binding android:key="actions.intent.START_EXERCISE">
            <parameter-binding
                android:key="exercise.name"
                android:value="@array/cyclingSynonyms" />
        </capability-binding>
    </shortcut>

    <!-- Add START_EXERCISE capability -->


    <!-- Add Stop Exercise intent parameter shortcuts -->


    <!-- Add STOP_EXERCISE capability-->
    <capability android:name="actions.intent.START_EXERCISE">
        <intent
            android:action="android.intent.action.VIEW"
            android:targetClass="com.devrel.android.fitactions.FitMainActivity"
            android:targetPackage="com.myapp.android.fitactions">
            <parameter
                android:name="exercise.name"
                android:key="exerciseType" />
        </intent>
    </capability>

</shortcuts>

I'm using MacOS Monterey with Apple M1 Pro chip.

like image 760
charlie Avatar asked Oct 19 '25 10:10

charlie


1 Answers

You can try to using the Stable version of Android Studio. And double check the path of shortcuts.xml, it only work if you put it in the main resources.

like image 136
Zú Zè Ze Avatar answered Oct 21 '25 23:10

Zú Zè Ze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!