My app has minSdk = 21 and targetSdk = 26
I wanted to set up the app shortcuts
I've added the <meta-data>
tag to the first activity that's launched when the app starts.
<activity android:name=".SignInActivity"
android:theme="@style/SubscriptionsTheme.NoActionBar">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts"/>
</activity>
Then I created the xml-v25
directory and within it this shortcuts.xml
file:
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
<shortcut
android:shortcutId="test"
android:icon="@drawable/plus"
android:shortcutShortLabel="test"
android:shortcutLongLabel="long test" >
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.xxxxx.xxxxx.xxxxx"
android:targetClass="com.xxxxx.xxxxx.xxxxxx.main" />
</shortcut>
</shortcuts>
when I try to build the app I get the following errors:
Error:error: 'long test' is incompatible with attribute android:shortcutLongLabel (attr) reference. Error:error: 'test' is incompatible with attribute android:shortcutShortLabel (attr) reference. Error:'long test' is incompatible with attribute android:shortcutLongLabel (attr) reference.