Android第一行代码-helloworld-及遇到的问题Manifest merger failed : Apps targeting Android 12 and higher are requ

问题:Manifest merger failed : Apps targeting Android 12 and higher are require …

缺少module或者sdk tools,或者不知道如何安装,移动后面 其他问题

Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

解决方法:

步骤:

1.File->project structure->modules->properties中
compile sdk version从31修改为30或其他
Build Tools version从31.0.0修改为30.0.2 需要与上面对应
如下图所示
Android第一行代码-helloworld-及遇到的问题Manifest merger failed : Apps targeting Android 12 and higher are requ_第1张图片2.File->project structure->modules->default config中
将target sdk version版本号与上面对应
Android第一行代码-helloworld-及遇到的问题Manifest merger failed : Apps targeting Android 12 and higher are requ_第2张图片

其他问题:

1.只有android 31,安装android 11.0 及其他

选中SDK Platforms,按照1.2.3步骤执行
Android第一行代码-helloworld-及遇到的问题Manifest merger failed : Apps targeting Android 12 and higher are requ_第3张图片

2.只安装了android 31.0.0 build tools工具,安装30.0.3工具

选中SDK TOOLS,按照1.2步骤执行
Android第一行代码-helloworld-及遇到的问题Manifest merger failed : Apps targeting Android 12 and higher are requ_第4张图片

3.android:exported问题

将andridmanifest.xml文件按照下面代码替换


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication">

    <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/Theme.MyApplication" />

        <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>
    application>

manifest>

Android第一行代码-helloworld-及遇到的问题Manifest merger failed : Apps targeting Android 12 and higher are requ_第5张图片

你可能感兴趣的:(android,android,android,studio,安卓)