2016-06-01 6 views
1

Netbeans를 사용하여 간단한 libGDX 프로젝트를 설정하려고합니다. 아쉽게도 제 컴파일러는 libGDX 항아리를 찾을 수 없습니다. Gradle이 자동으로 모든 종속성을 찾아서 설치하지 않겠습니까? 어떤 경우, 컴파일러는 내가 바탕 화면 프로젝트 '실행'하려고 할 때 저에게이를주고있다 :Netbeans에서 libGDX를 컴파일 할 수 없습니다.

Executing: gradle run 
Arguments: [-c, C:\dev\starling2\game\2016\fightland\libgdx\settings.gradle] 

Configuration on demand is an incubating feature. 
warning: [options] bootstrap class path not set in conjunction with -source 1.6 
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:3: error: package com.badlogic.gdx does not exist 
import com.badlogic.gdx.ApplicationAdapter; 
        ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:4: error: package com.badlogic.gdx does not exist 
import com.badlogic.gdx.Gdx; 
        ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:5: error: package com.badlogic.gdx.graphics does not exist 
import com.badlogic.gdx.graphics.GL20; 
           ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:6: error: package com.badlogic.gdx.graphics does not exist 
import com.badlogic.gdx.graphics.Texture; 
           ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:7: error: package com.badlogic.gdx.graphics.g2d does not exist 
import com.badlogic.gdx.graphics.g2d.SpriteBatch; 
            ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:9: error: cannot find symbol 
public class FightlandGdxGame extends ApplicationAdapter { 
            ^
    symbol: class ApplicationAdapter 
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:10: error: cannot find symbol 
    SpriteBatch batch; 
    ^
    symbol: class SpriteBatch 
    location: class FightlandGdxGame 
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:11: error: cannot find symbol 
    Texture img; 
    ^
    symbol: class Texture 
    location: class FightlandGdxGame 
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:13: error: method does not override or implement a method from a supertype 
    @Override 
    ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:15: error: cannot find symbol 
     batch = new SpriteBatch(); 
        ^
    symbol: class SpriteBatch 
    location: class FightlandGdxGame 
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:16: error: cannot find symbol 
     img = new Texture("badlogic.jpg"); 
       ^
    symbol: class Texture 
    location: class FightlandGdxGame 
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:19: error: method does not override or implement a method from a supertype 
    @Override 
    ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:21: error: package Gdx does not exist 
     Gdx.gl.glClearColor(1, 0, 0, 1); 
     ^
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:22: error: cannot find symbol 
     Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); 
        ^
    symbol: variable GL20 
    location: class FightlandGdxGame 
C:\dev\starling2\game\2016\fightland\libgdx\core\src\com\kitfox\fightland\FightlandGdxGame.java:22: error: package Gdx does not exist 
     Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); 
     ^
15 errors 
1 warning 
:core:compileJava FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':core:compileJava'. 
> Compilation failed; see the compiler error output for details. 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 2.246 secs 



Build failure (see the Notifications window for stacktrace): gradle run 

이 갓 libGDX 프로젝트 설정 유틸리티에서 생성 된 코드입니다. 나는 변화를 만들지 않았다. 루트 프로젝트의 소스 레벨을 1.6으로 변경하려고 시도했지만 도움이되지 않았습니다.

또 다른 게시물은 내 수업 경로에 libGDX 항아리를 넣는 것이 좋겠지 만,이 항아리가 무엇인지, 어디에서 찾을 수 있는지 잘 모르겠습니다.

나는 일 년 반 전에 이것을 기억하고 어떤 문제에 부딪치지 않는다. 내가 뭘 잘못하고 있는지 모르겠다.


그래서 나는 다소 설정 플러그인의 이전 버전에 의해 생성 된 libGDX 프로젝트에서 가져온 코드 내 build.gradle 파일을 패치하여 내 문제를 해결할 수 있었다. 기본적으로 gdx-setup.jar의 최신 버전에서 생성 된 build.gradle은 완전히 비어있는 'dependency'절이 있습니다. 나는 모양을 바꿔서 다시 작성했습니다

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-bullet-platform:$gdxVersion:natives-desktop" 
     compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" 
     compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion" 
    } 
} 

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-x86" 
     compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" 
     natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi" 
     natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a" 
     natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86" 
     compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" 
     natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" 
     natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" 
     natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" 
     compile "com.badlogicgames.gdx:gdx-ai:$aiVersion" 
    } 
} 

project(":ios") { 
    apply plugin: "java" 
    apply plugin: "robovm" 


    dependencies { 
     compile project(":core") 
     compile "org.robovm:robovm-rt:$roboVMVersion" 
     compile "org.robovm:robovm-cocoatouch:$roboVMVersion" 
     compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" 
     compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" 
     compile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios" 
     compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" 
    } 
} 

project(":html") { 
    apply plugin: "gwt" 
    apply plugin: "war" 


    dependencies { 
     compile project(":core") 
     compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion" 
     compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources" 
     compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources" 
     compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources" 
    } 
} 

project(":core") { 
    apply plugin: "java" 


    dependencies { 
     compile "com.badlogicgames.gdx:gdx:$gdxVersion" 
     compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion" 
     compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" 
     compile "com.badlogicgames.gdx:gdx-ai:$aiVersion" 
    } 
} 

이제 데스크톱 프로젝트가 컴파일되고 실행됩니다. 아직 안드로이드를 시도하지 않았습니다. ios 프로젝트에서 나에게 '종속성 해결 실패'에 대한 오류 메시지를 표시합니다.이 오류 메시지는 해결 방법을 잘 모릅니다. 나는 왜 설치 툴이 의존성 정보를 생성하지 않는지 궁금하다.


그리고 방금 설치 플러그 인의 최신 버전으로 프로젝트를 생성하려고 시도했지만이 시간이 걸렸습니다. 처음으로 내 의존성이 모두 비어있는 이유를 모르겠습니다.

답변

0

나는 또한 동일한 문제가있었습니다.

libgdx 설치 프로그램이 내 컴퓨터에 타사 확장을 추가하려고 할 때 런타임 예외가 발생했습니다. 예외가 발생한 후 일반적으로 표시되는 일반적인 생성기 대화 상자 중 하나가 표시되지 않았습니다.

  • 제 3 자 확장을 추가하지 않고 새 프로젝트를 생성 했으므로 이제는 성공적으로 일식으로 가져올 수있는 성공적인 프로젝트를 얻었습니다.
관련 문제