当前位置: 移动技术网 > 移动技术>移动开发>Android > AS中Default Activity not found的问题

AS中Default Activity not found的问题

2020年07月23日  | 移动技术网移动技术  | 我要评论

解决Default Activity not found的问题

是不是一直在为app旁边有个红×而苦恼?
是不是一开始选择了no activity?
是不是一直在显示default activity not found?

首先请先检查AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test2">

    <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=".FirstActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    </application>

</manifest>

你有《intent-filter》吗?如果没加的话,你只是注册了活动,并没有为程序配置主活动。就像在Visual Studio里面没有写main函数。

解决方法就是加上我上面贴的代码
就是《intent-filter》中间的东西。

注意那个《/activity》在后面

然后点那个锤子,我想你的困难就能解决啦

本文地址:https://blog.csdn.net/ITelk/article/details/107434205

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网