after creating project with libgdx, by opening/importing with both android studio/intellij IDEA i get same errors on both of them tried google and other stack,s answers didn't helped.
my gradle build
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "my-gdx-game"
gdxVersion = '1.9.6'
roboVMVersion = '2.3.1'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
Seems like the gdx.jar
is missing in your classpath.
Use Import project
instead of Open an existing AS project
.
Then click Refresh all Gradle project
(two circular arrow) that is available on top of Gradle Project menu.
For Gradle Project Menu use :
MenuBar's menu View
-> Tools Windows
-> Gradle
Create a fresh new project :
run gdx-setup.jar
by click or you can use cmd
Fill all Textfield with required value.
Select Sub Projects that you want in your project.
If you need extension select.
Click Advanced
button and select IDEA
and click Save.
Generate.
After successful creation of your project, import * your project in Android Studio/IntellijIDEA. Select root level build.gradle
file of project at the time of import.
* Required good internet connection while you importing your project 1 st time.
It worked for me
cmd
going to root folder, and used this command gradlew clean build
Screen shot here is the cmd command for gradle to download dependencies
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.