Android Studio "IDE error occured" on create new Activity

I ended up downgrading to 2.3.3 by getting the old version there: https://developer.android.com/studio/archive.html

UPDATE:
After testing with the solution posted here, the problem ended up being only that line in the project Gradle file:

buildDir = "C:/tmp/${rootProject.name}/${project.name}"

If you remove that line then everything will work. The other solution contains additional changes but they are not needed to fix the problem.


No need to downgrade. Just ensure you:

(a) apply gradle plugin 3.0.0, (b) add the repo references to "google()", and (c) remove the buildDir code from your project gradle file.

allprojects {
    //String osName = System.getProperty("os.name").toLowerCase();
    //if (osName.contains("windows")) {
    //    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    //}
    repositories {
        google()
        jcenter()
    }
}

I could add a new activity to an existing project after these steps.