Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Shortcuts - App isn't installed error even though targetPackage and targetClass are correct

I tried implementing the Android Shortcuts when holding the icons in the home screen. But when I try to launch them I get an

"App isn't installed" Toast

This is my shortcuts.xml:

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">

    <shortcut
        android:icon="@drawable/plus_black"
        android:shortcutId="add_sub"
        android:shortcutLongLabel="@string/shortcut_add_sub_long"
        android:shortcutShortLabel="@string/shortcut_add_sub">

        <intent
            android:action="android.intent.action.VIEW"
            android:targetClass="com.dancam.subscriptions.AddSubscription.AddSubscription"
            android:targetPackage="com.dancam.subscriptions.AddSubscription" />
    </shortcut>

    <shortcut
        android:icon="@drawable/pen"
        android:shortcutId="create_sub"
        android:shortcutLongLabel="@string/shortcut_create_sub_long"
        android:shortcutShortLabel="@string/shortcut_create_sub">

        <intent
            android:action="android.intent.action.VIEW"
            android:targetClass="com.dancam.subscriptions.CreateSubscription.CreateSubscription"
            android:targetPackage="com.dancam.subscriptions.CreateSubscription" />
    </shortcut>
</shortcuts>

I have already looked at this question but I couldn't find a suitable solution.

This is how my package/class tree looks like:

file tree

Any clue on how to fix this?

like image 314
Daniele Avatar asked Oct 20 '25 09:10

Daniele


1 Answers

Replace both android:targetPackage attribute values with your applicationId.

Here, "package" refers to the applicationId (a.k.a., package name), not the Java package of the class.

like image 111
CommonsWare Avatar answered Oct 22 '25 01:10

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!