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:
Error:(2, 0) Plugin with id 'jetty' not found
How should I fix this?
Currently html module using deprecated jetty plugin which is removed in Gradle 4.1 version.
Android Studio 3.0 using Gradle-4.1 and android-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
If you still want to use Android Studio 3.0
Downgrade Gradle to 3.3 from 4.1
Find gradle folder inside your project, Open
gradle-wrapper.propertiesand change distributionUrl for 3.3distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zipDowngrade Android-gradle-plugin to 2.3.3 from 3.0.0
Open root
build.gradlefile and find artifact and change versionclasspath 'com.android.tools.build:gradle:2.3.3'Comment/delete
google()from repo list
--------------------------------------------------------------------------------
EDIT : Update LibGDX project to Gradle 4.6 - AS USER
Upgrade Gradle to 4.6 :
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zipFind root
build.gradlefile of your project and add Google's Maven repo inproject repositories listas well as inbuildScript repo listrepositories { //.. 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.propertiesfile as shown below:org.gradle.configureondemand=falseTo 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.3and SdkVersion to27- Remove
instrumentTest.setRoot('tests')fromsourceSetsinside androidbuild.gradlefile - replace all
compilewithimplementationinside rootbuild.gradlefile - New
GWT Gradle Pluginadded in html module, check latest build.gradle of html module.
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.
Suggestion from Jetty Plugin team is to switch to gretty
Please check this Error while replacing jetty plugin to gretty plugin gradle
来源:https://stackoverflow.com/questions/46975883/error2-0-plugin-with-id-jetty-not-found