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

20,067

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.properties and change distributionUrl for 3.3

    distributionUrl=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 version

    classpath 'com.android.tools.build:gradle:2.3.3'
    
  • Comment/delete google() from repo list

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

EDIT : Update LibGDX project to Gradle 4.6 - AS USER

  1. Upgrade Gradle to 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

    repositories {
        //.. 
        google()
        jcenter()         // Required for org.jetbrains.trove4j:trove4j library
    }
    
  3. 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.

  4. Update Android buildToolsVersion to 27.0.3 and SdkVersion to 27

  5. Remove instrumentTest.setRoot('tests') from sourceSets inside android build.gradle file
  6. replace all compile with implementation inside root build.gradle file
  7. New GWT Gradle Plugin added 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.

Share:
20,067
Admin
Author by

Admin

Updated on December 07, 2020

Comments

  • Admin
    Admin over 3 years

    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?

  • MilanG
    MilanG over 6 years
    Great, this helped! Is there a way to find out what update is safe to apply before it crashes your project?
  • Abhishek Aryan
    Abhishek Aryan over 6 years
    crashes ?? If you're talking about desktop crash, you can use Terminal to run your desktop project.
  • MilanG
    MilanG over 6 years
    After the update I was not able to build the project at all. That's the crash I'm talking about. I would like to know what update is safe before I run it.
  • MilanG
    MilanG over 6 years
    I downgraded Gradle as you explained and it works well again. Error was the same as Eugenio explained at his question at top.
  • Julien
    Julien over 6 years
    Can you run the Desktop module also with this fix?
  • Abhishek Aryan
    Abhishek Aryan over 6 years
    @Julien yes, you can run desktop module
  • Taylor Liss
    Taylor Liss over 6 years
    Worked for me! Thank you!
  • Diljeet
    Diljeet over 6 years
    Thanks worked for me too, just found the "gradle-wrapper.properties" inside folder "gradle/wrapper" and found both "com.android.tools.build:gradle:3.0.1" and "google()" in the "build.gradle" file. Hope this helps, because everyone is expected to come to this answer whose not familiar with gradle options. Good Day
  • Pimentoso
    Pimentoso over 6 years
    Worked for me too. If you get an error like "Error:(74, 0) Gradle DSL method not found: 'implementation()'" make sure to replace all the 'implementation' calls back to 'compile' in build.gradle projects dependencies.
  • MrStahlfelge
    MrStahlfelge over 5 years
    Instead of experimenting yourself, simply upgrade to to libGDX' changed Gradle 4.6 toolchain.