Android 报错:Error running app:Default Activity not found

如题所述

第1个回答  2022-07-19
安卓工程文件打完包,之后运行出现:Error running app:Default Activity not found 报错: APP标志出现红叉:

解决办法:从网上找了很久答案,尝试大部分都有问题,EditConfiguration里launch选项下拉选择Nothing就可以,都是错误答案,误导和浪费我们的时间,正确的解决办法:

1.如果工程之前运行是好的,现在有问题,就不是AndroidManifest.xml,没有
<activity>标签里面的<intent-filter>加标签的问题;
如果真没加的话,需要在<activity>标签内部加入<intent-filter>标签,并在这个标签里<action android:name="android.intent.action.MAIN" />和<category android:name="android.intent.category.LAUNCHER" />声明。
因为没有为程序配置主活动,程序运行起来需要知道先启动哪一个;
2.这是我解决的办法:
打开 Android studio ——> File ——> Invalidate Caches/restart... ——> Invalidate and Restart (点击)
直接清除Android studio缓存,这个问题解决了;
相似回答
大家正在搜