Ich begann zu lernen, ligdx
vor einiger Zeit. Ich habe versucht, groovy
zu konfigurieren im Kernprojekt des Spiels zu arbeiten, aber jedesmal, wenn ich die Anwendung ausführen ich erhalte diese Ausnahmen:Fehler beim Konfigurieren groovy in libgdx Spiel
Error:Gradle: Execution failed for task :core:compileJava.
Error:Cannot compile Groovy files: no Groovy library is defined for module 'core'
Compilation failed; see the compiler error output for details.
Error:(16, 23) Gradle: error: cannot find symbol class testClass
Error:(16, 23) Gradle: error: cannot find symbol class testClass
mein Code:
public class MyGdxGame extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
testClass test = new testClass();
}
@Override
public void render() {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0);
batch.end();
}
@Override
public void dispose() {
batch.dispose();
img.dispose();
}
}
und
class testClass {
def scddsds(){
println('scddsds')
}
}
The Global gradle Datei ist:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "groovy-test"
gdxVersion = '1.9.3'
roboVMVersion = '2.1.0'
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"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile 'org.codehaus.groovy:groovy:2.4.6:grooid'
}
}
tasks.eclipse.doLast {
delete ".project"
}
Der gradle Build des Kernprojektes ist:
apply plugin: "java"
sourceCompatibility = 1.6
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project {
name = appName + "-core"
}
I Android Studio verwenden.
teilen Sie Ihre 'build.gradle' – Enigo
ich es geschrieben. bitte schau es dir an – RexsosTheAlien