欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

AS中Default Activity not found的问题

程序员文章站 2022-03-28 17:57:40
解决Default Activity not found的问题是不是一直在为app旁边有个红×而苦恼?是不是一开始选择了no activity?是不是一直在显示default activity not found?首先请先检查AndroidManifest.xml

解决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