Gradle sync failed when using custom DSL

I am getting this error:
Gradle sync failed: Unable to load class ‘com.android.build.gradle.managed.ProductFlavor_Impl’.

when trying to setup a gradle.build file according to this documentation: http:// tools. android.com/tech-docs/new-build-system/gradle-experimental

Can I get some help figuring out what’s wrong? Here’s a lot more info on this obstacle:

Okay this is the answer that sorted out the problem for me: http://stackoverflow.com/a/32624978/1610950

Thanks to @[Gabriele Mariotti] on StackOverflow