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 需要与上面对应
如下图所示
对应版本号2.File->project structure->modules->default config中
将target sdk version版本号与上面对应
对应版本号

其他问题:

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

选中SDK Platforms,按照1.2.3步骤执行
安装sdk包

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

选中SDK TOOLS,按照1.2步骤执行
安装sdk tools包

3.android:exported问题

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

<?xml version="1.0" encoding="utf-8"?>
<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>

对应xml文件

  • 4
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值