Android工程编译时报 Error running app: Default Activity not found错误
16lz
2021-01-24
今天在编译Android工程文件,由于是将其他工程代码移到该工程下编译的,所以编译出了点问题,报Error running app: Default Activity not found错误。
网上搜了下,一种方法是将 Edit Configurations中选择General目录下的Launch Options,选中Nothing,但是编译后模拟器中app并不能运行 。所以继续查找方法,最终在stackoverflow上找到了。问题定位在AndroidManifest.xml文件中,注意查看自己的该文件。本人自己的如下:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.zhuzhixiong.uibestpractice"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> application>manifest>
修改后如下:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.zhuzhixiong.uibestpractice"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> intent-filter> activity> application>manifest>
增加了activity后可编译成功运行。
更多相关文章
- Android(安卓)Activity启动(二) App内部activity跳转过程及原理
- LinearLayout和RelativeLayout绘制过程的对比
- Android(安卓)ListView的背景和黑色边缘化的问题
- 利用ActivityInstrumentationTestCase2测试Activity
- Ogre3d 之使用 Android(安卓)NativeActivity
- android开发之Parcelable使用详解
- 第一个Android工程HelloAndroid
- android sample之Notepad(带下划线的TestView)
- Android设置中“强行停止”详解