我已经为我的应用程序创建了应用程序快捷方式。但是当我点击那个快捷方式时它说 “读取应用数据失败无法启动应用”
我已经添加了
<uses-permission android:name="android.permission.INSTALL_SHORTCUT"/>
这一行在我的 list 文件中,我也添加了
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts"/>
我的主要 Intent 过滤器中的这一行:-
这是我的 shortcuts.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_trackconsignment"
android:shortcutId="tracking"
android:shortcutShortLabel="@string/track"
android:shortcutLongLabel="@string/track">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="in.vesolve.deliveryflyking.activities.revamp"
android:targetClass="in.vesolve.deliveryflyking.activities.revamp.ConsignmentTrackActivity"
/>
</shortcut>
</shortcut>
输出:-
Shortcut Option
Result
我的设备:Relame 7,Android 10,Realme UI 1.0
提前致谢:)
最佳答案
在 Android manifest 文件中,在 launcher activity 标签中添加以下代码
android:exported="true"
关于Android 应用程序快捷方式不起作用。获取错误 "Failed to read the app data cannot start the app",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66207674/