java 错误:(2, 0) 未找到 ID 为“jetty”的插件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46975883/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error:(2, 0) Plugin with id 'jetty' not found
提问by B. Eugenio
Yesterday I upgraded Android Studio to version 3.0, but I'm working with LibGdx and after the upgrade I cannot build my project.
昨天我将 Android Studio 升级到 3.0 版,但我正在使用 LibGdx,升级后我无法构建我的项目。
When I'm try to build, it gives me an error:
当我尝试构建时,它给了我一个错误:
Error:(2, 0) Plugin with id 'jetty' not found
错误:(2, 0) 未找到 ID 为“jetty”的插件
How should I fix this?
我应该如何解决这个问题?
回答by Aryan
Currently html moduleusing deprecated jetty plugin
which is removed in Gradle 4.1 version.
当前使用已弃用的html 模块jetty plugin
在 Gradle 4.1 版本中被删除。
Android Studio 3.0 using Gradle-4.1
and android-gradle-plugin:3.0.0
Android Studio 3.0 使用Gradle-4.1
和android-gradle-plugin:3.0.0
Gradle 4.1 is not supported yet in LibGDX, there is an issuefor the same, which is now upgradedfor Gradle 4.6
LibGDX 尚不支持 Gradle 4.1,同样存在一个问题,现已针对 Gradle 4.6升级
If you still want to use Android Studio 3.0
如果您还想使用 Android Studio 3.0
Downgrade Gradle to 3.3 from 4.1
Find gradle folder inside your project, Open
gradle-wrapper.properties
and change distributionUrl for 3.3distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Downgrade Android-gradle-plugin to 2.3.3 from 3.0.0
Open root
build.gradle
file and find artifact and change versionclasspath 'com.android.tools.build:gradle:2.3.3'
Comment/delete
google()
from repo list
将 Gradle 从 4.1 降级到 3.3
在您的项目中找到 gradle 文件夹,打开
gradle-wrapper.properties
并更改 3.3 的 distributionUrldistributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
将 Android-gradle-plugin 从 3.0.0 降级到 2.3.3
打开根
build.gradle
文件并找到工件并更改版本classpath 'com.android.tools.build:gradle:2.3.3'
google()
从回购列表中评论/删除
--------------------------------------------------------------------------------
-------------------------------------------------- ------------------------------
EDIT: Update LibGDX project to Gradle 4.6 - AS USER
编辑:将 LibGDX 项目更新到 Gradle 4.6 - 作为用户
Upgrade Gradle to 4.6 :
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Find root
build.gradle
file of your project and add Google's Maven repo inproject repositories list
as well as inbuildScript repo list
repositories { //.. google() jcenter() // Required for org.jetbrains.trove4j:trove4j library }
Update Android Gradle Plugin :
classpath 'com.android.tools.build:gradle:3.1.3'
Known issues with the Android Gradle Plugin
Configuration on demand with Gradle 4.6 and above:
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.)
Disable configuration on demand in your
gradle.properties
file as shown below:org.gradle.configureondemand=false
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.
In Android Studio 3.2 Beta 1 and higher, the options for enabling configuration on demand have been removed.
Update Android buildToolsVersion to
27.0.3
and SdkVersion to27
- Remove
instrumentTest.setRoot('tests')
fromsourceSets
inside androidbuild.gradle
file - replace all
compile
withimplementation
inside rootbuild.gradle
file - New
GWT Gradle Plugin
added in html module, check latest build.gradleof html module.
将 Gradle 升级到 4.6 :
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
找到根
build.gradle
项目的文件,并添加谷歌的Maven的回购中project repositories list
,以及在buildScript repo list
repositories { //.. google() jcenter() // Required for org.jetbrains.trove4j:trove4j library }
更新 Android Gradle 插件:
classpath 'com.android.tools.build:gradle:3.1.3'
Android Gradle 插件的已知问题
Gradle 4.6 及以上版本按需配置:
如果您将 Android Gradle 插件 3.0.x 或 3.1.x 与 Gradle 4.6 及更高版本一起使用,您应该按需禁用配置以避免一些不可预测的构建错误。(如果您使用的是 Android Gradle Plugin 3.2.0 或更高版本,则无需执行任何操作来禁用按需配置。)
在您的
gradle.properties
文件中按需禁用配置,如下所示:org.gradle.configureondemand=false
要在 Android Studio 设置中禁用按需配置,请选择 File > Settings(Android Studio > Preferences on Mac),在左侧窗格中选择 Compiler 类别,然后清除 Configure on demand 复选框。
在 Android Studio 3.2 Beta 1 及更高版本中,已删除启用按需配置的选项。
将 Android buildToolsVersion
27.0.3
和 SdkVersion更新为27
instrumentTest.setRoot('tests')
从sourceSets
androidbuild.gradle
文件中删除compile
用implementation
内部根build.gradle
文件替换所有内容- 新
GWT Gradle Plugin
的HTML模块中添加,查看最新的build.gradleHTML模块。
Run your project with Run Configuration
or On Terminal using gradle task
.
使用Run Configuration
或 On Terminal运行您的项目gradle task
。
If you're going to create new project use gdx-setup.jar
of latest build.
如果您要创建新的项目中使用gdx-setup.jar
的最新版本。
回答by Rafael
Suggestion from Jetty Plugin team is to switch to gretty
Jetty Plugin 团队的建议是切换到 gretty
Please check this Error while replacing jetty plugin to gretty plugin gradle