<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.MyApplicationImage" tools:targetApi="31"> <activity android:name=".MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- MainActivity --> <activity android:name=".MainActivity" android:theme="@style/AppTheme.NoActionBar" tools:ignore="DuplicateActivity,WrongManifestParent" /> <!-- ImageProcessingActivity --> <activity android:name=".ImageProcessingActivity" android:theme="@style/AppTheme.NoActionBar" tools:ignore="WrongManifestParent" /> </application> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> </manifest>
时间: 2024-03-07 20:50:55 浏览: 118
自动更新apk,xamarin.android 对话框
看起来您的问题就在于您在 AndroidManifest.xml 文件中定义了两个 MainActivity。请删除第一个 MainActivity,使得您的代码如下所示:
```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplicationImage"
tools:targetApi="31">
<!-- MainActivity -->
<activity android:name=".MainActivity"
android:exported="true"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ImageProcessingActivity -->
<activity android:name=".ImageProcessingActivity"
android:theme="@style/AppTheme.NoActionBar"
tools:ignore="WrongManifestParent" />
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
```
请注意,我已经将 MainActivity 的 intent-filter 移动到了 MainActivity 标签内部,并且删除了第一个 MainActivity 标签。
阅读全文