You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Incorrect package="com.huawei.hms.flutter.push" found in source AndroidManifest.xml: C:\Users\Lenovo\AppData\Local\Pub\Cache\hosted\pub.dev\huawei_push-6.12.0+303\android\src\main\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.huawei.hms.flutter.push" from the source AndroidManifest.xml: C:\Users\Lenovo\AppData\Local\Pub\Cache\hosted\pub.dev\huawei_push-6.12.0+303\android\src\main\AndroidManifest.xml.
The text was updated successfully, but these errors were encountered:
val targetProjects = listOf("huawei_push", "platform_device_id_plus", "google_huawei_availability")
subprojects {
afterEvaluate {
if (name in targetProjects && extensions.findByName("android") != null) {
// Register the fix task only for target projects
val fixTask = tasks.register("fixManifestsAndNamespace") {
doLast {
val buildGradleFile = file("build.gradle")
val manifestFile = file("src/main/AndroidManifest.xml")
// Step 1: Set namespace from package if not already present
if (manifestFile.exists()) {
val manifestContent = manifestFile.readText(Charsets.UTF_8)
val packageRegex = Regex("""package\s*=\s*"([^"]+)"""")
val match = packageRegex.find(manifestContent)
val packageName = match?.groups?.get(1)?.value
if (packageName != null && !buildGradleFile.readText().contains("namespace")) {
println("Setting namespace in ${buildGradleFile.path}")
val updatedBuildGradle = buildGradleFile.readText().replaceFirst(
Regex("""android\s*\{"""),
"android {\n namespace = \"$packageName\""
)
buildGradleFile.writeText(updatedBuildGradle, Charsets.UTF_8)
}
}
// Step 2: Remove `package` from all AndroidManifest.xml files in the project
val manifestFiles = fileTree("src/main") {
include("**/AndroidManifest.xml")
}
manifestFiles.forEach { file ->
val content = file.readText()
if (content.contains("package=")) {
println("Removing package attribute from ${file.path}")
val updated = content.replace(Regex("""package\s*=\s*"[^"]*""""), "")
file.writeText(updated)
}
}
}
}
// Ensure the task runs before preBuild
tasks.matching { it.name.startsWith("preBuild") }.configureEach {
dependsOn(fixTask)
}
}
}
}
Incorrect package="com.huawei.hms.flutter.push" found in source AndroidManifest.xml: C:\Users\Lenovo\AppData\Local\Pub\Cache\hosted\pub.dev\huawei_push-6.12.0+303\android\src\main\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.huawei.hms.flutter.push" from the source AndroidManifest.xml: C:\Users\Lenovo\AppData\Local\Pub\Cache\hosted\pub.dev\huawei_push-6.12.0+303\android\src\main\AndroidManifest.xml.
The text was updated successfully, but these errors were encountered: