This message was deleted.
# kotlin-dsl
s
This message was deleted.
m
I believe I have asked the question in the right place?
v
Assuming
outputFileName
is a
Property<String>
, there is for long a magic in Groovy DSL that you can use
=
, but for Kotlin this was long not possible. You need either to use
.set(...)
or a recent enough Gradle version where the
=
usage works for `Property`s.
And yes, as your question is indeed Kotlin DSL specific, the channel is perfectly fine.
👍 1
m
OutputFileName isn't a field in kotlin dsl
v
That's then probably more a question about version
m
Agp version?
v
yes
m
I believe then in that case I'll have to bring down the versions of other dependencies as well Any other methods that you may be aware of? I'll look into it
v
I am no Android developer. All I'm saying is, that if the property exists in that blog, but not for you, it might be a difference in version. If it is only available on older versions, you should probably check what the replacement for it is instead of downgrading. If it is only available on newer versions, you should probably update.
But actually, you said "val and cant be reassigned" is thrown, not that the property does not exist. And that would mean the property esists and you can assign it with Groovy DSL, with recent enough Kotlin DSL, or by using
.set
instead of
=
as I explained above.
m
This got reesolved... Actually output is an implementation of the BaseOutputVariant interface... When I had cast it to BaseOutputVariantImpl It worked
v
Casting to
...Impl
is probably a bad idea though. If
outputFileName
is only available on
BaseOutputVariantImpl
, but not on
BaseOutputVariant
, then it just works in Groovy DSL due to its duck-typing. But it would be a bad idea in Groovy DSL too, as it uses things that are not meant for your usage and could break in any patch version as it is an implementation detail you rely on.