You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio配置Manifest启动SplashActivity出现intent-filter报错如何解决?

错误原因
  • AndroidManifest.xml的节点结构有严格语法规范,<intent-filter>必须作为对应<activity>的子节点存在。你当前配置中提前用/>闭合了SplashActivity的<activity>标签,导致<intent-filter>直接作为<application>的子节点,属于非法结构,因此触发AAPT资源链接错误。
修复方法

将SplashActivity的自闭合标签修改为普通开始标签,把<intent-filter>节点包裹在SplashActivity的<activity>标签内部即可,调整后的完整配置如下:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.company.numberguessingapp"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="31" />

    <application
        android:allowBackup="true"
        android:appComponentFactory="androidx.core.app.CoreComponentFactory"
        android:debuggable="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:testOnly="true"
        android:theme="@style/Theme.NumberGuessingApp" >
        <activity
            android:name="com.company.numberguessingapp.SplashActivity"
            android:exported="true" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.company.numberguessingapp.MainActivity"
            android:exported="true" >
        </activity>
    </application>
</manifest>

修复完成后重新同步项目构建配置,再运行即可正常将SplashActivity识别为启动页,展示开屏动画。

内容的提问来源于stack exchange,提问作者Equlo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.05 14:42:02