I was following the official documentation for making shortcuts to show in the launcher. When I start testing I get this error. How can I fix it? what am I doing wrong?
Error:(6, 23) No resource found that matches the given name (at 'icon' with value '@drawable/compose_icon').
Error:(8, 36) No resource found that matches the given name (at 'shortcutLongLabel' with value '@string/compose_shortcut_long_label1').
my code is this
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="compose"
android:enabled="true"
android:icon="@drawable/compose_icon"
android:shortcutShortLabel="@string/compose_shortcut_short_label1"
android:shortcutLongLabel="@string/compose_shortcut_long_label1"
android:shortcutDisabledMessage="@string/compose_disabled_message1">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.example.myapplication"
android:targetClass="com.example.myapplication.ComposeActivity" />
<!-- If your shortcut is associated with multiple intents, include them
here. The last intent in the list determines what the user sees when
they launch this shortcut. -->
<categories android:name="android.shortcut.conversation" />
</shortcut>
<!-- Specify more shortcuts here. -->
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
You will need to provide a valid icon and string resource. Seems like you are trying out the sample in the documentation directly. The compiler will not point out errors in this file, so you need to be careful with the resources you mention.
Specifically, define
compose_shortcut_short_label1
,compose_shortcut_long_label1
andcompose_disabled_message1
in your strings with proper names and also a valid drawable resource forcompose_icon
.Also change the
android:targetPackage
andandroid:targetClass
attributes accordingly.