2017-10-24 10 views
0

저는 휴대 전화에서 AIDE를 사용하여 libgdx 엔진을 사용하여이 프로그램을 작성하고 있습니다. 내가 프로그램을 실행할 때 거의 즉시 충돌합니다. 나는 많은 것을 할 수있는 기회가 없었지만 문제를 내 사진을로드하려고 시도하는 것으로 좁혔습니다. 코드 "Texture (Gdx.files.internal ("button_center.png "))를 삭제/프로그램을 실행할 수 있습니다. 다른 이미지는 프로젝트를 시작할 때 사전로드되었으므로 아무런 문제가 없습니다. 내 이미지를 동일한 폴더로 이동하여 이미지를 빌드하고 새로 고침을 시도했지만 앱이 계속 충돌합니다. 나는이 오류 로그라고 생각이미지를로드하는 동안 AIDE가 libgdx 엔진과 충돌하는 이유는 무엇입니까?

package pavlov.murderdoggyalpha; 

import com.badlogic.gdx.*; 
import com.badlogic.gdx.graphics.*; 
import com.badlogic.gdx.graphics.g2d.*; 
import pavlov.murderdoggyalpha.*; 



public class MyGdxGame implements ApplicationListener 
{ 
    Texture texture; 
    Texture butDownLeft; 
    Texture butLeft; 
    Texture butUpLeft; 
    Texture butDown; 
    Texture butCenter; 
    Texture butUp; 
    Texture butDownRight; 
    Texture butRight; 
    Texture butUpRight; 
    SpriteBatch batch; 
    int touchX; 
    int touchY; 


    @Override 
    public void create() 
    { 
     texture = new Texture(Gdx.files.internal("android.jpg")); 
     butCenter = new Texture(Gdx.files.internal("button_center.png")); 
     batch = new SpriteBatch(); 
    } 

    @Override 
    public void render() 
    {   
     Gdx.gl.glClearColor(1, 1, 1, 1); 
     Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); 
     batch.begin(); 

     batch.draw(texture, touchX, touchY, 
        Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); 
      if (Gdx.input.justTouched()); 
      { 
       touchX = Gdx.input.getX(); 
       touchY = Gdx.input.getY(); 
      } 
     batch.end(); 

    } 

    @Override 
    public void dispose() 
    { 
    } 

    @Override 
    public void resize(int width, int height) 
    { 
    } 

    @Override 
    public void pause() 
    { 
    } 

    @Override 
    public void resume() 
    { 
    } 

} 

:

여기에 코드입니다. 나는 사전에 사과한다, 나는 이것에 관해 새로운 사람이다.

은 나에게 서 : 때 java.io.IOException :

에 의한에만 8 비트를 픽스맵로드 할 수 없습니다.

나머지는 다음과 같습니다.

10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime FATAL EXCEPTION : 30,571 GLThread 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime 프로세스 : pavlov.murderdoggyalpha, PID : 3786 10-23 19시 48분 : 59.061 3786 4066 E AndroidRuntime com.badlogic.gdx.utils.GdxRuntimeException : 파일을로드 할 수 없습니다. button_center.png 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Pixmap. Pixmap.java:140) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare (FileTextureData.java:64) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime (com.badlogic.gdx.graphics.Texture.load) (Texture.java:130) 10-2 3 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Texture. (Texture.java:121) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime (com.badlogic.gdx.graphics). 텍스처 (Texture.java:100) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Texture (Texture.java:92) 10-23 19 : 48 : 59.061 3786 (MyGdxGame.java) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at pavlov.murderdoggyalpha.MyGdxGame.create (MyGdxGame.java) 10- 23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged (AndroidGraphics.java:236) 10-23 19 : 48 : 59.061 3786 4066 AndroidRuntime at android.opengl.GLSurfaceView $ GLThread .guardedRun (GLSurfaceView.java:1519) 10-23 19 : 48 : 59.061 3786 4066 E android.opengl.GLSurfaceView의 AndroidRuntime $ GLThread.run (GLSurfaceView.java:1240) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime 발생 원인 : java.io.IOException : pixmap 8bit 만로드 할 수 없습니다. 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.g2d.Gdx2DPixmap (Gdx2DPixmap.java:57)) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Pixmap. (Pixmap.java:138) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime ... 10 자세히 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime 치명적인 예외 : GLThread 30571 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime 프로세스 : pavlov.murderdoggyalpha, PID : 3786 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime com.badlogic.gdx.utils.GdxRuntimeException : 파일을로드 할 수 없습니다. button_center.png 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic. gdx.graphics.Pixmap. (Pixmap.java:140) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare (FileTextureData.java:64) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Texture.load (Texture.java:130) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Texture. (Texture.java:121) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Texture. (Texture.java:100) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.Texture (Texture.java:92) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime (MyGdxGame.java:35) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at pavlov.murderdoggyalpha.MyGdxGame.create (MyGdxGame.java) 10-23 19 : 48 : 59.061 3786 4066 E Andro idRuntime at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged (AndroidGraphics.java:236) 10-23 19 : 48 : 59.061 3786 4066 E android.opengl.GLSurfaceView의 AndroidRuntime $ GLThread.guardedRun (GLSurfaceView.java : 1519) 10-23 19 : 48 : 59.061 3786 4066 android.opengl.GLSurfaceView의 AndroidRuntime $ GLThread.run (GLSurfaceView.java:1240) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime 발생 원인 : java. io.IOException : 픽스맵 8 비트 만로드 할 수 없습니다. 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime at com.badlogic.gdx.graphics.g2d.Gdx2DPixmap. (Gdx2DPixmap.java:57) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime (com.badlogic.gdx.graphics.Pixmap). (Pixmap.java:138) 10-23 19 : 48 : 59.061 3786 4066 E AndroidRuntime ... 10 더 10-2

+0

오류 로그가 있습니까? –

+0

방금 ​​추가했습니다 – Jake

+0

Murder doggy alpha? 정말? 어쨌든, libgdx에서 Button_center.png를로드하는 데 문제가 있습니다. 파일 이름이 올바른지, 올바른 파일 확장자인지 확인하십시오. –

답변

0

Google 어시스턴트로 인해 파기를 한 후 "원인 : java.io.IOException : pixmap 8bit 만로드 할 수 없습니다."어떤 이유로 16bit png 이미지를로드하는 데 문제가 있음을 발견했습니다. 나는 lunapics에 가서 파일 확장자를 gif로 바꾸기 위해 8 비트 이미지로 바꾸는 방법을 몰랐다. 응용 프로그램은 지금 잘 실행됩니다.