偷懒的解决方案:
在app目录下的 build.gradle 中添加以下内容
//下面两行添加上
import groovy.xml.XmlUtil
import kotlin.text.Charsets
android {
compileSdkVersion 1.0
buildToolsVersion 31.0.1
//从这里开始拷贝,如果缺了反}括弧的自行补上即可
android {
applicationVariants.all { variant ->
variant.outputs.all { output ->
output.processResources.doFirst { pm ->
//适配安卓12,手动把三方sdk添加了 intent-filter ,但是缺少 android:exported的情况
String manifestPath = output.processResources.manifestFile
println "=====Adapt Android 12. modify manifestPath=====$manifestPath"
def manifestFile = file(manifestPath)
def xml = new XmlParser().parseText(manifestFile.getText())
def childNode = xml.children()
String keyStaff = "{http://schemas.android.com/a