Closed elrony closed 3 years ago
I think it should be androidComponents
instead of android
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello,
tried the following in android/app/build.gradle (bottom of the file)
androidComponents {
onVariantProperties {
for (output in outputs) {
val processedVersionCode = output.versionCode.map { playVersionCode ->
"$versionNameOverride.$playVersionCode"
}
output.versionName.set(processedVersionCode)
}
}
}
but I am still getting errors:
No signature of method: build_cvc4d1ripugzvx42x6hgp7lyh.androidComponents() is applicable for argument types: (build_cvc4d1ripugzvx42x6hgp7lyh$_run_closure5) values: [build_cvc4d1ripugzvx42x6hgp7lyh$_run_closure5@2a829418]
Are you sure you've applied the Android Gradle Plugin? The error is saying that android
and androidComponents
don't exist which probably means you're not applying AGP or aren't in the right file.
Hello,
The project I am working on is a react-native project. It has an android/build.gradle and an android/app/build.gradle.
android/build.gradle has the following:
....
dependencies {
classpath "com.android.tools.build:gradle:4.2.0"
...
android/app/build.gradle I did the following:
replaced the very first line:
- apply plugin: "com.android.application"
+ plugins {
+ id("com.android.application")
+ id("com.github.triplet.play") version "3.4.0-agp4.2"
+ }
And added at the bottom of the file just after the closure of play { ... } the following:
androidComponents {
onVariantProperties {
for (output in outputs) {
val processedVersionCode = output.versionCode.map { playVersionCode ->
"$versionNameOverride.$playVersionCode"
}
output.versionName.set(processedVersionCode)
}
}
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Whoops, will try to check this tonight.
I think you might actually have to use AGP 7.0.0 (or at least, I know it works there). That means you'll also need GPP 3.4.0-agp7.0 (instead of 3.4.0-agp4.2).
Thanks!
Unfortunately I am unable to upgrade to gradle 7, my project does not allow it for the time being. Will keep it in mind for when I can upgrade
Hello, I have recently upgraded Gradle and GGP and updated its configuration all fine except I had to change the old outputProcessor{versionNameOverride...} to the new android{onVariantProperties...} and the build now is breaking with the error below.
I spent quite some time going through the issues here and found help with picking version 3.4.0-agp4.2 but I can't figure how to solve the problem with onVariantProperties.
Error
This was my old config (in android/app/build.gradle)
This is my new config
Versions
Tasks executed
stacktrace.txt
Am I doing something wrong?
Any help appreciated. Thanks!