简体   繁体   English

错误:(2,0)找不到ID为'jetty'的插件

[英]Error:(2, 0) Plugin with id 'jetty' not found

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? 我该怎么解决这个问题?

Currently html module using deprecated jetty plugin which is removed in Gradle 4.1 version. 目前使用弃用的jetty plugin html模块在Gradle 4.1版本中被删除。

Android Studio 3.0 using Gradle-4.1 and android-gradle-plugin:3.0.0 Android Studio 3.0使用Gradle-4.1android-gradle-plugin:3.0.0

Gradle 4.1 is not supported yet in LibGDX, there is an issue for the same, which is now upgraded for 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 将Gradle从4.1下调至3.3

    Find gradle folder inside your project, Open gradle-wrapper.properties and change distributionUrl for 3.3 在项目中查找gradle文件夹,打开gradle-wrapper.properties并更改3.3的DistributedUrl

     distributionUrl=https\\://services.gradle.org/distributions/gradle-3.3-all.zip 
  • Downgrade Android-gradle-plugin to 2.3.3 from 3.0.0 将Android-gradle-plugin从3.0.0降级到2.3.3

    Open root build.gradle file and find artifact and change version 打开root build.gradle文件并查找工件并更改版本

     classpath 'com.android.tools.build:gradle:2.3.3' 
  • Comment/delete google() from repo list 从回购列表中注释/删除google()

-------------------------------------------------------------------------------- -------------------------------------------------- ------------------------------

EDIT : Update LibGDX project to Gradle 4.6 - AS USER 编辑 :将LibGDX项目更新为Gradle 4.6 - AS USER

  1. Upgrade Gradle to 4.6 : 将Gradle升级到4.6:

     distributionUrl=https\\://services.gradle.org/distributions/gradle-4.6-all.zip 
  2. 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 查找项目的root build.gradle文件,并在project repositories listbuildScript repo list添加Google的Maven repo

     repositories { //.. google() jcenter() // Required for org.jetbrains.trove4j:trove4j library } 
  3. Update Android Gradle Plugin : 更新Android Gradle插件:

    classpath 'com.android.tools.build:gradle:3.1.3'

    Known issues with the Android Gradle Plugin Android Gradle插件的已知问题

    Configuration on demand with Gradle 4.6 and above: 使用Gradle 4.6及更高版本按需配置:

    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. 如果您在Gradle 4.6及更高版本中使用Android Gradle Plugin 3.0.x或3.1.x,则应按需禁用配置以避免一些不可预测的构建错误。 (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.) (如果您使用的是Android Gradle Plugin 3.2.0或更高版本,则无需采取任何操作来按需禁用配置。)

    Disable configuration on demand in your gradle.properties file as shown below: gradle.properties文件中按需禁用配置,如下所示:

    • 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. 要在Android Studio设置中按需禁用配置,请选择“文件”>“设置”(Mac上的Android Studio>“偏好设置”),在左窗格中选择“编译器”类别,然后清除“按需配置”复选框。

      In Android Studio 3.2 Beta 1 and higher, the options for enabling configuration on demand have been removed. 在Android Studio 3.2 Beta 1及更高版本中,已删除了按需启用配置的选项。

  4. Update Android buildToolsVersion to 27.0.3 and SdkVersion to 27 将Android buildToolsVersion更新为27.0.3 ,将SdkVersion更新为27

  5. Remove instrumentTest.setRoot('tests') from sourceSets inside android build.gradle file 从android build.gradle文件中的sourceSets删除instrumentTest.setRoot('tests')
  6. replace all compile with implementation inside root build.gradle file 用root build.gradle文件中的implementation替换所有compile
  7. New GWT Gradle Plugin added in html module, check latest build.gradle of html module. 在html模块中添加了新的GWT Gradle Plugin ,检查html模块的最新build.gradle

Run your project with Run Configuration or On Terminal using gradle task . 使用gradle task Run Configuration或On Terminal运行项目。


If you're going to create new project use gdx-setup.jar of latest build . 如果您要创建新项目,请使用最新版本的 gdx-setup.jar

Suggestion from Jetty Plugin team is to switch to gretty Jetty插件团队的建议是切换到gretty

Please check this Error while replacing jetty plugin to gretty plugin gradle 将jetty插件替换为gretty插件gradle时请检查此错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM