This message was deleted.
# android
s
This message was deleted.
r
This would be really helpful, @no any ideas around this? 👀
n
which part doesn't work? I recommend using a gradle property to conditionally apply plugins.
Copy code
if (foo) {
  apply plugin: 'applovin-quality-service'
}
y
which part doesn’t work?
Copy code
!getGradle().getStartParameter().getTaskRequests().toString().contains("Dev")
getTaskRequests returns object ref now
n
what does it return?
y
Copy code
println(getGradle().getStartParameter().getTaskRequests().toString())
-> [org.gradle.internal.RunDefaultTasksExecutionRequest@8fc678c]
n
can you call
getArgs
on that object? Would that be what you are looking for?
y
Copy code
println(getGradle().getStartParameter().getTaskRequests().toString())
println(getGradle().getStartParameter().getTaskRequests().args)
println(getGradle().getStartParameter().getTaskRequests().metaPropertyValues)
println(getGradle().getStartParameter().getTaskRequests().properties)
-> [org.gradle.internal.RunDefaultTasksExecutionRequest@6beea1b1] [[]] [groovy.lang.PropertyValue@6d747f14, groovy.lang.PropertyValue@c8685c6] {class=class java.util.ArrayList, empty=false} args returns [[]] regarding this code:
Copy code
getGradle().getStartParameter().getTaskRequests().toString()
I found it on SO and didn’t check what “getGradle().getStartParameter().getTaskRequests()” returns, but it worked.
Copy code
contains("Dev")
Dev is just one buildType (other are debug release) the idea of this code is “if current build type is dev - don’t apply plugin
applovin-quality-service
”
n
what about this?
Copy code
gradle.startParameter.taskNames
🤔 1
y
let me check this
Copy code
println(getGradle().getStartParameter().getTaskNames().toString())
-> [] btw my setup is: gradle version - 7.6 Android Gradle Plugin - 7.3.1 I call this code ing main module build.gradle, right after
apply plugin:
section:
Copy code
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

if (!getGradle().getStartParameter().getTaskRequests().toString().contains("Dev")) {
    apply plugin: 'applovin-quality-service'
}

....
n
This is surprising 😕
d
if you’re upgrading to AGP 7.3.1 form 7.2.x or older, do be aware of this bug - https://issuetracker.google.com/issues/235863809