Hey! Does anyone has faced this warning on gradle ...
# gradle
r
Hey! Does anyone has faced this warning on gradle android plugin version 8.9?
Copy code
androidComponents {
        beforeVariants(selector().withBuildType("release")) { variant ->
            if (variant.name.contains("generic")) {
                variant.enable = false
            }
        }

        onVariants { variant ->
            variant.outputs.forEach { output ->
                if (output is VariantOutputImpl) {
                    if (output.baseName.contains("newline"))
                        output
                            .outputFileName
                            .value("app-${getNewlineDevice().name}-${getEnvironmentEnum()}-${output.baseName}.apk")
                    else
                        output
                            .outputFileName
                            .value("app-${getEnvironmentEnum()}-${output.baseName}.apk")
                }
            }
        }
    }
It maarks androidComponentes with
Copy code
Suspicious receiver type; this does not apply to the current receiver of type BaseAppModuleExtension. This will apply to a receiver of type Project, found in one of the enclosing lambdas. Make sure it's declared in the right place in the file. Toggle info (⌘F1)
v
I don't do any Android, and you missed to supply the most important, what it complains about, the outer scope. But from the message I'd say you have written
Copy code
android {
    androidComponents {
    }
}
which should instead be
Copy code
android {
}
androidComponents {
}
or if it was the only content of the android block, then
Copy code
androidComponents {
}
Having it inside the
android { ... }
block is just visual clutter if it does not operate on that extension actually.
r
😕 that makes totally sense, Haven't realized
thanks!
👌 1