问题
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:
Any clue on how to fix this?
回答1:
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.
来源:https://stackoverflow.com/questions/48695766/android-shortcuts-app-isnt-installed-error-even-though-targetpackage-and-targ