Android快捷方式-即使targetPackage和targetClass正确,也未安装应用程序错误 [英] Android Shortcuts - App isn't installed error even though targetPackage and targetClass are correct
问题描述
在主屏幕中按住图标时,我尝试实现了Android快捷方式.但是当我尝试启动它们时,我得到了一个
I tried implementing the Android Shortcuts when holding the icons in the home screen. But when I try to launch them I get an
未安装应用" Toast
"App isn't installed" Toast
这是我的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?
推荐答案
将两个android:targetPackage
属性值都替换为applicationId
.
Replace both android:targetPackage
attribute values with your applicationId
.
此处,包"是指applicationId
(又称包名称),而不是该类的Java包.
Here, "package" refers to the applicationId
(a.k.a., package name), not the Java package of the class.
这篇关于Android快捷方式-即使targetPackage和targetClass正确,也未安装应用程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!