无法将 Android Gradle 插件 3.0.+ 与 IntelliJ IDEA 一起使用
Can't use Android Gradle Plugin 3.0.+ with IntelliJ IDEA
当我尝试将 Android Gradle Plugin 3.0.+ 与 Intellij IDEA 一起使用时,出现错误:Error:This Gradle plugin requires Studio 3.0 minimum
但我的 IntelliJ 版本高于 2017.2,它应该与 AS 3.0 的 gradle 插件一起使用。
可以通过将此选项添加到您的 gradle.properties
:
来解决
android.injected.build.model.only.versioned=3
解释:
来自 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
更新
IntelliJ IDEA 2018.1+支持AndroidGradle插件3.0+!
在 gradle.properties
文件中添加 android.injected.build.model.only.versioned=3
属性(按照 ) 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 问题的建议)。
当我尝试将 Android Gradle Plugin 3.0.+ 与 Intellij IDEA 一起使用时,出现错误:Error:This Gradle plugin requires Studio 3.0 minimum
但我的 IntelliJ 版本高于 2017.2,它应该与 AS 3.0 的 gradle 插件一起使用。
可以通过将此选项添加到您的 gradle.properties
:
android.injected.build.model.only.versioned=3
解释:
来自 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
更新
IntelliJ IDEA 2018.1+支持AndroidGradle插件3.0+!
在 gradle.properties
文件中添加 android.injected.build.model.only.versioned=3
属性(按照 install
Gradle tasks... until a version of IntelliJ IDEA is released that supports Android 3.x features (keep an eye on this JetBrains 问题的建议)。