Could not get unknown property 'targetName' for project ':app' of type org.gradle.api.Project

Could not get unknown property ‘targetName’ for project ‘:app’ of type org.gradle.api.Project

Well, if it is not there, don’t try to access it.