English 中文(简体)
GdxRuntimeException: Cann tload file
原标题:GdxRuntimeException: Couldn t load file

下面是ts libgdx的辅导。 试图做的是,用坏logic印本(复印件称为Wawa.jpg):

public class HelloWorld implements ApplicationListener {
    SpriteBatch spriteBatch;
    Texture texture;
    Texture watched_texture;
    BitmapFont font;
    Vector2 textPosition = new Vector2(100, 100);
    Vector2 textDirection = new Vector2(5, 3);

    @Override
    public void create () {
        font = new BitmapFont();
        font.setColor(Color.RED);
        texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
        watched_texture = new Texture(Gdx.files.internal("data/wawa.jpg"));
        spriteBatch = new SpriteBatch();
    }
...

什么是申请的坠毁和“com.badlogic.gdx.utils.GdxRuntimeException: 能否提供t tload data/wa.jpg” in debug:

10-18 09:24:45.383: WARN/dalvikvm(330): threadid=9: thread exiting with uncaught exception (group=0x40015560)
10-18 09:24:45.502: ERROR/AndroidRuntime(330): FATAL EXCEPTION: GLThread 10
10-18 09:24:45.502: ERROR/AndroidRuntime(330): com.badlogic.gdx.utils.GdxRuntimeException: couldn t load file  wawa.jpg 
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:135)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.badlogic.gdx.graphics.Texture.(Texture.java:126)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.badlogic.gdx.graphics.Texture.(Texture.java:104)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.test.myfirsttriangle.MyFirstTriangle.create(MyFirstTriangle.java:29)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceCreated(AndroidGraphics.java:284)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
10-18 09:24:45.502: ERROR/AndroidRuntime(330): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/wawa.jpg (Internal)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:64)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:132)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     ... 6 more
10-18 09:24:45.502: ERROR/AndroidRuntime(330): Caused by: java.io.FileNotFoundException: data/wawa.jpg
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at android.content.res.AssetManager.openAsset(Native Method)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at android.content.res.AssetManager.open(AssetManager.java:314)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at android.content.res.AssetManager.open(AssetManager.java:288)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:62)
10-18 09:24:45.502: ERROR/AndroidRuntime(330):     ... 7 more

能够说明什么错误。

最佳回答

解决:一把新案文放在甲状腺项目的“资产”夹中

问题回答

I also had the same problem, but my mistake was a file name error.

档案被称作“游戏”。 巴布亚新几内亚和我把这句话说成“Mescreenshot.png”。

In Windows it accepted the file name fine, but on android it didn t work, so I had to rename it to "gameScreenshot.PNG"





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签