我的libgdx游戏无法在台式机上运行,​​但不能在android

时间:2018-07-21 17:09:51

标签: java eclipse libgdx game-development

您知道,我一直在用Libgdx编写长期游戏,我一直使用gradlew安装apk调试程序并在android上进行尝试,事实是我已经完成了它,它很重,而且我在手机上使用gradlew对其进行了测试,但不同之处在于,它现在无法运行,不能在android上运行,但可以在桌面上运行。为什么?我不知道有什么问题,我没有输入代码,因为代码很多,正如我说的没什么不对的,就是不要在Android上运行。 -我用日食。 最糟糕的部分是我不知道自己做了什么,因为在它运行到Android之前。

清单:

<?xml version="1.0" encoding="utf-8"?>

<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="20" />

<application android:name="android.support.multidex.MultiDexApplication>
    <uses-library android:name="android.test.runner" />
</application>

<instrumentation android:name="android.test.InstrumentationTestRunner"
                 android:targetPackage="com.cubopez.es"
                 android:handleProfiling="false"
                 android:functionalTest="false"
                 android:label="Tests for com.cubopez.es"/>


</manifest>

(在我尝试添加Multidex之前,这不起作用)

错误消息(我试图删除引发该错误的mp3资产,但其他mp3资产再次失败):

  

E / AndroidRuntime:致命异常:GLThread 22480进程:   com.cubopez.blast,PID:31220主题:   主题:{default = overlay:com.zui.theme.XuiSkin.blue,iconPack:system,   fontPkg:system,com.android.systemui = overlay:system,   com.android.systemui.navbar = overlay:system} com.badlogic.gdx.utils.GdxRuntimeException:   com.badlogic.gdx.utils.GdxRuntimeException:无法加载依赖项   资产:winter.mp3,位于   com.badlogic.gdx.assets.AssetManager.handleTaskError(AssetManager.java:582)   在com.badlogic.gdx.assets.AssetManager.update(AssetManager.java:383)   在   com.badlogic.gdx.assets.AssetManager.finishLoading(AssetManager.java:404)   在com.cubopez.blast.MainGame.create(MainGame.java:129)处   com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:311)   在   android.opengl.GLSurfaceView $ GLThread.guardedRun(GLSurfaceView.java:1519)   在android.opengl.GLSurfaceView $ GLThread.run(GLSurfaceView.java:1240)

     

原因:com.badlogic.gdx.utils.GdxRuntimeException:无法加载   资产的依存关系:winter.mp3位于   com.badlogic.gdx.assets.AssetLoadingTask.handleAsyncLoader(AssetLoadingTask.java:121)   在   com.badlogic.gdx.assets.AssetLoadingTask.update(AssetLoadingTask.java:90)   在   com.badlogic.gdx.assets.AssetManager.updateTask(AssetManager.java:507)   在com.badlogic.gdx.assets.AssetManager.update(AssetManager.java:381)   在   com.badlogic.gdx.assets.AssetManager.finishLoading(AssetManager.java:404)   在com.cubopez.blast.MainGame.create(MainGame.java:129)   com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:311)   在   android.opengl.GLSurfaceView $ GLThread.guardedRun(GLSurfaceView.java:1519)   在android.opengl.GLSurfaceView $ GLThread.run(GLSurfaceView.java:1240)

     

原因:com.badlogic.gdx.utils.GdxRuntimeException:   com.badlogic.gdx.utils.GdxRuntimeException:加载音频文件时出错:   注意:内部音频文件必须放置在资产中   目录。在   com.badlogic.gdx.utils.async.AsyncResult.get(AsyncResult.java:46)在   com.badlogic.gdx.assets.AssetLoadingTask.handleAsyncLoader(AssetLoadingTask.java:119)   ...另外8个

     

原因:com.badlogic.gdx.utils.GdxRuntimeException:   加载音频文件时出错:winter.mp3注意:内部音频文件必须为   放置在资产目录中。在   com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:120)   在   com.badlogic.gdx.assets.loaders.MusicLoader.loadAsync(MusicLoader.java:48)   在   com.badlogic.gdx.assets.loaders.MusicLoader.loadAsync(MusicLoader.java:29)   在   com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:70)   在   com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:34)   在   com.badlogic.gdx.utils.async.AsyncExecutor $ 2.call(AsyncExecutor.java:58)   在java.util.concurrent.FutureTask.run(FutureTask.java:237)在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)   在   java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:588)   在java.lang.Thread.run(Thread.java:818)

     

原因:   java.io.FileNotFoundException:winter.mp3在   android.content.res.AssetManager.openAssetFd(本机方法)位于   android.content.res.AssetManager.openFd(AssetManager.java:357)在   com.badlogic.gdx.backends.android.AndroidFileHandle.getAssetFileDescriptor(AndroidFileHandle.java:237)   在   com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:110)   在   com.badlogic.gdx.assets.loaders.MusicLoader.loadAsync(MusicLoader.java:48)   在   com.badlogic.gdx.assets.loaders.MusicLoader.loadAsync(MusicLoader.java:29)   在   com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:70)   在   com.badlogic.gdx.assets.AssetLoadingTask.call(AssetLoadingTask.java:34)   在   com.badlogic.gdx.utils.async.AsyncExecutor $ 2.call(AsyncExecutor.java:58)   在java.util.concurrent.FutureTask.run(FutureTask.java:237)在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)   在   java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:588)   在java.lang.Thread.run(Thread.java:818)

用于收取资产费用的部分代码:

  public class MainGame extends Game {
private AssetManager manager;
private BaseScreen menu, levels, game;
protected int Height, Width;
private boolean isLoaded = false;
    private Texture pez;
    @Override
    public void create () {

manager = new AssetManager();
manager.load("cubopez.png", Texture.class);
manager.load("menu.png", Texture.class);
manager.load("levels.png", Texture.class);
manager.load("playButton.png", Texture.class);
manager.load("background1.png", Texture.class);
manager.load("background2.png", Texture.class);
manager.load("background3.png", Texture.class);
manager.load("winscreen.png", Texture.class);
manager.load("cubopezgrade1.png", Texture.class);
manager.load("cubopezgrade2.png", Texture.class);
manager.load("cubopezgrade3.png", Texture.class);
manager.load("cubopezgrade4.png", Texture.class);
manager.load("cubopezgrade5.png", Texture.class);
manager.load("cubopezgrade6.png", Texture.class);
manager.load("cubopezgrade7.png", Texture.class);
manager.load("supercubopez.png", Texture.class);
manager.load("supercubopez1.png", Texture.class);
manager.load("supercubopez2.png", Texture.class);
manager.load("supercubopez3.png", Texture.class);
manager.load("supercubopez4.png", Texture.class);
manager.load("supercubopez5.png", Texture.class);
manager.load("supercubopez6.png", Texture.class);
manager.load("supercubopez7.png", Texture.class);
manager.load("supercubopez8.png", Texture.class);
manager.load("rubik8bits.png", Texture.class);
manager.load("alga1.png", Texture.class);
manager.load("alga2.png", Texture.class);
manager.load("alga3.png", Texture.class);
manager.load("alga4.png", Texture.class);
manager.load("mar.png", Texture.class);
manager.load("cementerio.png", Texture.class);
manager.load("nieve.png", Texture.class);
manager.load("martick.png", Texture.class);
manager.load("cementeriotick.png", Texture.class);
manager.load("nievetick.png", Texture.class);
manager.load("mistery.png", Texture.class);
manager.load("barradavidavacia.png", Texture.class);
manager.load("barradavida1.png", Texture.class);
manager.load("barradavida2.png", Texture.class);
manager.load("barradavida3.png", Texture.class);
manager.load("barradavida4.png", Texture.class);
manager.load("barradavida5.png", Texture.class);
manager.load("barradavida6.png", Texture.class);
manager.load("barradavida7.png", Texture.class);
manager.load("barradavida8.png", Texture.class);
manager.load("barradavida9.png", Texture.class);
manager.load("barradavida10.png", Texture.class);
manager.load("barradavidavaciaboss.png", Texture.class);
manager.load("barradavida1boss.png", Texture.class);
manager.load("barradavida2boss.png", Texture.class);
manager.load("barradavida3boss.png", Texture.class);
manager.load("barradavida4boss.png", Texture.class);
manager.load("barradavida5boss.png", Texture.class);
manager.load("barradavida6boss.png", Texture.class);
manager.load("barradavida7boss.png", Texture.class);
manager.load("barradavida8boss.png", Texture.class);
manager.load("barradavida9boss.png", Texture.class);
manager.load("barradavida10boss.png", Texture.class);
manager.load("rubik8bitsscrambled.png", Texture.class);
manager.load("cubopezmuerto.png", Texture.class);
manager.load("neodimio.png", Texture.class);
manager.load("skeltoncubopez.png", Texture.class);
manager.load("gameover.png", Texture.class);
manager.load("ghostfish.png", Texture.class);
manager.load("titulo.png", Texture.class);
manager.load("tiburon.png", Texture.class);
manager.load("tiburon2.png", Texture.class);
manager.load("nado.ogg", Sound.class);
manager.load("punch.ogg", Sound.class);
manager.load("boss.png", Texture.class);
manager.load("copo.png", Texture.class);
manager.load("copo2.png", Texture.class);
manager.load("copo3.png", Texture.class);
manager.load("estalactita.png", Texture.class);
manager.load("bubble.png", Texture.class);
manager.load("bubble2.png", Texture.class);
manager.load("bubble3.png", Texture.class);
manager.load("bossbackground.png", Texture.class);
manager.load("darkcubopez.png", Texture.class);
manager.load("mirror.png", Texture.class);
manager.load("powerup.ogg", Sound.class);
manager.load("music1.ogg", Music.class);
manager.load("fight.ogg", Music.class);
manager.load("winter.ogg", Music.class);
manager.load("music2.ogg", Music.class);
manager.load("winsound.ogg", Music.class);
manager.load("gameoversound.ogg", Sound.class);
manager.load("pyraminx.png", Texture.class);
manager.load("info.png", Texture.class);
manager.load("pyraminxscrambled.png", Texture.class);
manager.load("mirrorcube.png", Texture.class);
manager.load("mirrorscrambled.png", Texture.class);
manager.load("megaminx.png", Texture.class);
manager.load("megaminxscrambled.png", Texture.class);
manager.load("menusound.ogg", Music.class);








     manager.finishLoading();

1 个答案:

答案 0 :(得分:0)

这可能与您的纹理图集分辨率有关...如果分辨率较大,并且您要测试的电话已经过时。某些设备不能处理超过1024x1024