android - Android Studio Manifest - 意图过滤器问题
问题描述
因为我想用一些动画来启动我的应用程序。我需要先开始动画活动。SplashActivity 是动画活动。
在清单中我试过这个:
<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
android:name="com.company.numberguessingapp.MainActivity"
android:exported="true" >
</activity>
</application>
</manifest>
但我得到了这个错误:
执行 com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction 时发生故障 Android 资源链接失败 ERROR:/Users/kalilux/AndroidStudioProjects/NumberGuessingApp/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml:25 :AAPT:错误:在 中发现意外元素。
第 25 行是在哪里。
解决方案
感谢您发布所有清单代码。关闭活动标签时确实存在错误intent-filter
你应该输入
<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.SplashActivity"
android:exported="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
推荐阅读
- android - 具有动态适配器大小的嵌套回收器视图
- rabbitmq - Rabbitmq 无缝升级,无需停机
- c# - FlowDocumentScrollViewer 在滚动时崩溃
- ionic-framework - Ionic 3 + Protractor 触发滑动手势(e2e 测试应在 Chrome 浏览器或通过 Appium 的设备上运行??)
- sql - 如何获得所有“许多”结果都符合条件的结果?
- rxjs - 创建递归可观察循环?
- angular - Angular Material 表单域标签字体颜色和大小
- android - IDE 出错,但项目运行成功
- sql - XML 路径 SQL 服务器
- typescript - Angular 6 中的 Zone.js