3

Trying to test my android shortcuts but I keep getting an error stating that attribute android:shortcutLongLabel not found, and this continues with shorcutShortLabel, shortcutID, etc. Shouldn't make a difference but I am writing the app in kotlin, and am using compileSdkVersion 29.

Trying to add app shortcuts to my project. So I created the shortcuts.xml file and added it to res/xml/shortcuts.xml. I've made sure everything in Gradle was up to date, and have followed Google's documentation down to the dot on adding shortcuts in your app. I assume there is something wrong with either my Gradle or manifest.xml but I don't know what. Also when I hit F2 it says no errors found on this file.

<?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>

Every time the following happens when I build my project:

AAPT: error: attribute android:shortcutLongLabel not found. AAPT: error: attribute android:shortcutShortLabel not found. AAPT: error: attribute android:shortcutID not found.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Try setting your min API level (not compile level) to 25. Also see this: https://stackoverflow.com/questions/46644119/android-error-while-trying-to-add-app-shortcuts – Doug Stevenson Oct 11 '21 at 17:40

0 Answers0