我的腳本後顯示圖像,每次我在Android工作室上運行它,但每次我嘗試運行腳本它發佈後,我不斷收到錯誤顯示勝利臉的有趣圖片。我不太清楚爲什麼每次運行腳本時都會出現錯誤,因爲當我放入笑臉圖像時,它會起作用。錯誤當試圖在Android工作室(Java)上添加圖像
這裏的腳本:
package com.udacity.gamedev.logging;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class LoggingDemo extends ApplicationAdapter {
// TODO: Give your ApplicationListener a log TAG]
public static final String TAG = LoggingDemo.class.getName();
SpriteBatch batch;
Texture img;
@Override
public void create() {
batch = new SpriteBatch();
img = new Texture("Trump.jpg");
// TODO: Use Gdx.app to find what ApplicationType we're running
// TODO: Use Gdx.app to log the result
Gdx.app.log(TAG, "We're running on" +
Gdx.app.getType()
);
}
@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();
}
// TODO: Run the Desktop app and find your log message
// TODO: Run the Android app and find your log message
}
這裏的錯誤: enter image description here