To fix this error in Unity 6, I had to enable "Custom Main Gradle Template" and "Custom Gradle Settings Template" in "Android Project Settings" to get it to build!