Can't use new Android Gradle Plugin with IntelliJ IDEA
Asked Answered
G

2

6

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.

Gomes answered 8/10, 2017 at 18:50 Comment(0)
G
28

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+!

Gomes answered 8/10, 2017 at 18:50 Comment(0)
P
1

Adding the android.injected.build.model.only.versioned=3 property in the gradle.properties file (as suggested here) will get the Gradle sync working but you may run into issues when trying to deploy your Android app onto a device or emulator from within IntelliJ. For that you'll probably have to use Android Studio 3.x or one of the install Gradle tasks... until a version of IntelliJ IDEA is released that supports Android 3.x features (keep an eye on this JetBrains issue).

Phyl answered 21/11, 2017 at 17:54 Comment(6)
What issues you mean? I use IDEA as main IDE and haven't any issues.Gomes
Mainly the issues I'm seeing are around installing the APK on the device or emulator when trying to run the app or instrumentation tests from IntelliJ. I suspect these issues will be fixed with the release of IDEA 2017.3 (see link in my answer) but in the meanwhile I'm using Android Studio.Phyl
Have you found a solution to this? I am facing the exact same problem with IDEA 2017.3Frans
I've resorted to using Android Studio until Android Studio 3.0 features are added to IntelliJ. I've updated my answer to link to the JetBrains issue that's open for this.Phyl
@kliron, try to add flag -t to your app Run Configuration in Intellij IDEAGomes
This flag should be in "Install flags"Gomes

© 2022 - 2024 — McMap. All rights reserved.