I have a similar problem to this question
Could not get unknown property 'applicationVariants' for object of type com.android.build.gradle.LibraryExtension.
I am trying to check for this property and do something if I have it. I assumed I could follow this answer:
// for application modules
if (project.hasProperty('applicationVariants')) {
println "has applicationVariants"
android.applicationVariants.all { variant ->
// ... do something
}
}
// for library modules
if (project.hasProperty('libraryVariants')) {
println "has libraryVariants"
android.libraryVariants.all { variant ->
// ... do something
}
}
However I'm not seeing any of the print statements and none of the inner code is executing. What am I missing?