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.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
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 in project repositories list
as well as in buildScript 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 to 27
instrumentTest.setRoot('tests')
from sourceSets
inside android build.gradle
filecompile
with implementation
inside root build.gradle
fileGWT 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.