首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >插件无法识别shortcuts.xml

插件无法识别shortcuts.xml
EN

Stack Overflow用户
提问于 2022-10-25 05:01:44
回答 2查看 50关注 0票数 0

我正在使用AndroidStudioChipmunk2021.2.1修补程序1,我遵循代码实现。但出于某种原因,每当我试图构建应用程序或尝试使用谷歌助理Android Studio插件时,它都会给我以下错误:-

在Android中没有列出与shortcuts.xml或actions.xml匹配的资源。

这是我的Android清单文件:-

代码语言:javascript
复制
<?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>

这是res/xml文件夹中的shortcuts.xml:-

代码语言:javascript
复制
<?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>

我用的是MacOS蒙特利和苹果M1 Pro芯片。

EN

回答 2

Stack Overflow用户

发布于 2022-10-25 07:06:11

您可以尝试使用稳定版本的Android。再次检查shortcuts.xml的路径,只有将它放在主资源中才能工作。

票数 1
EN

Stack Overflow用户

发布于 2022-10-25 08:45:34

我通过将Gradle插件升级到最新版本(7.2.1)来解决这个问题。

在Android中,从Tools菜单中单击AGP升级助手,只需按照说明操作即可。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74189288

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档