由于错误"App isn't installed",快捷方式始终处于禁用状态



首先,我在这里阅读了其他解决方案尝试,但由于某种原因,它们的修复程序对我不起作用。

我的快捷方式 XML 如下所示:

<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_tinted"
android:shortcutId="shortcut"
android:shortcutLongLabel="@string/shortcut_longLabel"
android:shortcutShortLabel="@string/shortcut_shortLabel"
android:shortcutDisabledMessage="@string/shortcut_disabledMessage">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="de.example.exampleApp.exampleClass"
android:targetPackage="de.example.exampleApp" />
<categories android:name= "android.shortcut.example" />
</shortcut>
</shortcuts>

我在 AndroidManifest 文件中的相关代码如下所示:

<activity
android:name=".common.ui.activities.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>

我确保在我的build.gradle中,ApplicationId是de.example.exampleApp

我不知道还能做什么。如果它以任何方式相关,我会在 Genymotion 模拟器而不是真实设备上测试我的应用程序。

好吧,因为我似乎忽略了您只能为Activities快捷方式的信息(例如android:targetClass必须是Activity)

作为解决方案,我使用了一种黑客(?)解决方案,您可以在此处看到

最新更新