运行时发生:android.intent.action.MAIN 与 android.intent.category.LAUNCHER
16lz
2021-01-26
$ adb shell am start -n "com.hlx.administrator.hello/com.hlx.administrator.hello.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Unexpected error while executing: am start -n "com.hlx.administrator.hello/com.hlx.administrator.hello.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while Launching activity
第一种情况:有MAIN,无LAUNCHER,程序列表中无图标 原因:android.intent.category.LAUNCHER决定应用程序是否显示在程序列表里
第二种情况:无MAIN,有LAUNCHER,程序列表中无图标Hello2
Unexpected error while executing: am start -n "com.hlx.administrator.hello/com.hlx.administrator.hello.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while Launching activity
第一种情况:有MAIN,无LAUNCHER,程序列表中无图标 原因:android.intent.category.LAUNCHER决定应用程序是否显示在程序列表里
第二种情况:无MAIN,有LAUNCHER,程序列表中无图标
原因:android.intent.action.MAIN决定应用程序最先启动的Activity,如果没有Main,则不知启动哪个Activity,故也不会有图标出现
解决方案:
(1)修改AndroidManifest.XML文件
<?xml version="1.0" encoding="utf-8"?> -------这是必须要添加的部分:------------ -------------------------------------------
(2)添加如图所示:res|values|strings.xml|
运行OK
更多相关文章
- shell批量转换iOS和Android图标
- Qt for Android程序沉浸式启动页面(去除标题栏、去除黑屏、保留后
- 扩大攻击层面:React Native Android应用程序
- Android全面解析之Context机制
- Android(安卓)系列 4.6在显示其他应用程序的同时运行后台服务
- Android冷启动与热启动概念
- 【Android】webView 使用 系统自带搜索对话框问题
- Android下的一种编程框架
- Xamarin.Android-捕获未处理异常(全局异常)