Search code examples
androidintellij-ideagradle-plugin

Can't use new Android Gradle Plugin with IntelliJ IDEA


When I'm trying to use Android Gradle Plugin 3.0.+ with Intellij IDEA, I'm getting error: Error:This Gradle plugin requires Studio 3.0 minimum

But my version of IntelliJ is higher than 2017.2 and it should work with gradle plugin for AS 3.0.


Solution

  • It can be fixed by adding this option to your gradle.properties:

    android.injected.build.model.only.versioned=3
    

    Explanation:

    From Reddit /r/androiddev

    A version check is in place in ModelBuilder that is fed by Gradle properties inserted by the IDE when you execute the Sync action. The fix is to add the following to gradle.properties: android.injected.build.model.only.versioned=3

    AS 3.0 is sending the value 3, whereas older versions as well as IntelliJ send 1 or lower, if they send a value at all. Once set as specified, sync works again and everything so far has been operating normally.

    Full answer with comments from Android Studio team

    UPDATE

    IntelliJ IDEA 2018.1+ supports Android Gradle Plugin 3.0+!