错误:(2, 0) 未找到 ID 为“jetty"的插件 [英] Error:(2, 0) Plugin with id 'jetty' not found
问题描述
昨天我将 Android Studio 升级到 3.0 版,但我正在使用 LibGdx,升级后我无法构建我的项目.
Yesterday I upgraded Android Studio to version 3.0, but I'm working with LibGdx and after the upgrade I cannot build my project.
当我尝试构建时,它给了我一个错误:
When I'm try to build, it gives me an error:
错误:(2, 0) 未找到 ID 为jetty"的插件
Error:(2, 0) Plugin with id 'jetty' not found
我应该如何解决这个问题?
How should I fix this?
推荐答案
当前 html 模块使用已弃用的 jetty 插件
,该插件已在 Gradle 4.1 版本中删除.
Currently html module using deprecated jetty plugin
which is removed in Gradle 4.1 version.
Android Studio 3.0 使用 Gradle-4.1
和 android-gradle-plugin:3.0.0
Android Studio 3.0 using Gradle-4.1
and android-gradle-plugin:3.0.0
LibGDX 尚不支持 Gradle 4.1,有一个问题,现在 已升级用于 Gradle 4.6
Gradle 4.1 is not supported yet in LibGDX, there is an issue for the same, which is now upgraded for Gradle 4.6
如果你还想使用Android Studio 3.0
If you still want to use Android Studio 3.0
将 Gradle 从 4.1 降级到 3.3
Downgrade Gradle to 3.3 from 4.1
在你的项目中找到 gradle 文件夹,打开 gradle-wrapper.properties
并将 distributionUrl 更改为 3.3
Find gradle folder inside your project, Open gradle-wrapper.properties
and change distributionUrl for 3.3
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
将 Android-gradle-plugin 从 3.0.0 降级到 2.3.3
Downgrade Android-gradle-plugin to 2.3.3 from 3.0.0
打开根 build.gradle
文件并找到工件并更改版本
Open root build.gradle
file and find artifact and change version
classpath 'com.android.tools.build:gradle:2.3.3'
评论/删除存储库列表中的 google()
编辑:将 LibGDX 项目更新到 Gradle 4.6 - AS USER
EDIT : Update LibGDX project to Gradle 4.6 - AS USER
将 Gradle 升级到 4.6:
Upgrade Gradle to 4.6 :
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
找到您项目的根 build.gradle
文件并在 project repositories list
以及 buildScript repo list
中添加 Google 的 Maven repo代码>
Find root build.gradle
file of your project and add Google's Maven repo in project repositories list
as well as in buildScript repo list
repositories {
//..
google()
jcenter() // Required for org.jetbrains.trove4j:trove4j library
}
更新 Android Gradle 插件:
Update Android Gradle Plugin :
classpath 'com.android.tools.build:gradle:3.1.3'
Android Gradle 插件的已知问题
使用 Gradle 4.6 及更高版本按需配置:
Configuration on demand with Gradle 4.6 and above:
如果您使用 Android Gradle 插件 3.0.x 或 3.1.x 和 Gradle 4.6及以上,您应该按需禁用配置以避免一些不可预测的构建错误.(如果您使用的是 Android Gradle 插件3.2.0 或更高版本,您不需要执行任何操作来禁用按需配置.)
If you're using Android Gradle Plugin 3.0.x or 3.1.x with Gradle 4.6 and above, you should disable configuration on demand to avoid some unpredictable build errors. (If you are using Android Gradle Plugin 3.2.0 or higher, you do not need to take any action to disable configuration on demand.)
在您的 gradle.properties
文件中禁用按需配置,如下所示:
Disable configuration on demand in your gradle.properties
file as shown below:
org.gradle.configureondemand=false
要在 Android Studio 设置中禁用按需配置,请选择文件 > 设置(Mac 上为 Android Studio > 首选项),在左侧窗格中选择编译器类别,然后清除按需配置复选框.
To disable configuration on demand in the Android Studio settings, choose File > Settings (Android Studio > Preferences on Mac), select the Compiler category in the left pane, and clear the Configure on demand checkbox.
在 Android Studio 3.2 Beta 1 及更高版本中,已删除启用按需配置的选项.
In Android Studio 3.2 Beta 1 and higher, the options for enabling configuration on demand have been removed.
将 Android buildToolsVersion 更新为 27.0.3
并将 SdkVersion 更新为 27
Update Android buildToolsVersion to 27.0.3
and SdkVersion to 27
使用 Run Configuration
或在终端上使用 gradle task
运行您的项目.
Run your project with Run Configuration
or On Terminal using gradle task
.
如果您要创建新项目,请使用 最新版本.
If you're going to create new project use gdx-setup.jar
of latest build.
这篇关于错误:(2, 0) 未找到 ID 为“jetty"的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!