尝试测试我的 android 快捷方式,但我不断收到错误消息,指出未找到属性 android:shortcutLongLabel,这继续使用 shorcutShortLabel、shortcutID 等。应该没有什么不同,但我正在用 kotlin 编写应用程序,并且正在使用 compileSdkVersion 29.
尝试将应用程序快捷方式添加到我的项目中。所以我创建了shortcuts.xml 文件并将其添加到res/xml/shortcuts.xml。我确保 Gradle 中的所有内容都是最新的,并且一直遵循 Google 的文档,直到在您的应用程序中添加快捷方式。我认为我的 Gradle 或 manifest.xml 有问题,但我不知道是什么。此外,当我按 F2 时,它说在此文件上没有发现错误。
<?xml version="1.0" encoding=utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut android:enable="true"
android:shortcutID="xxxx"
android:icon="@drawable/xxxxx"
android:shortcutShortLabel="@string/xxxx"
android:shortcutLongLabel="@string/xxxxx">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="com.example.test"
android:targetClass="com.example.test.TestIntent/>
</shortcut>
每次在我构建项目时都会发生以下情况:
AAPT:错误:找不到属性 android:shortcutLongLabel。AAPT:错误:找不到属性 android:shortcutShortLabel。AAPT:错误:找不到属性 android:shortcutID。