Finally, I found that the scanning failed because of a task. I directly disabled these tasks in build.gradle that caused errors and successfully ran the scan,The specific code is as follows
gradle.taskGraph.whenReady {
tasks.each { task →
if (task.name.contains(“AndroidTestResources”) || task.name.contains(“minifyCustomReleaseWithR8”) || task.name.contains(“shrinkCustomReleaseRes”)) {
task.enabled = false
}
}
}