android obb / zip音乐&声音加载(cocos2dx)

时间:2015-03-20 10:37:42

标签: java android audio cocos2d-x

我使用这个答案:https://stackoverflow.com/a/18739812/2904688将我的Android应用程序拆分为APK和ZIP,它就像一个魅力。

虽然应用程序正常启动,但所有声音都没有播放。 Cocos2dxMusic.java& Cocos2dxSound.java似乎无法读取zip中的声音文件。所有资产(图像,动画等)都正确加载,但声音(音乐和SFX)似乎无法加载。

assets.zip 路径的相对位置正确,如日志所示。 有线索吗?我使用的是cocos2d-x 2.2.0

这里引发了错误代码:

03-20 08:29:08.275: E/Cocos2dxMusic(31653): error: Attempt to invoke virtual method 'android.content.res.AssetFileDescriptor.com.android.vending.expansion.zipfile.ZipResourceFile.getAssetFileDescriptor(java.lang.String)' on a null object reference

03-20 08:29:08.275: E/Cocos2dxMusic(31653): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.AssetFileDescriptor com.android.vending.expansion.zipfile.ZipResourceFile.getAssetFileDescriptor(java.lang.String)' on a null object reference

03-20 08:29:08.275: E/Cocos2dxMusic(31653):     at org.cocos2dx.lib.Cocos2dxMusic.createMediaplayer(Cocos2dxMusic.java:249)

03-20 08:29:08.275: E/Cocos2dxMusic(31653):     at org.cocos2dx.lib.Cocos2dxMusic.playBackgroundMusic(Cocos2dxMusic.java:112)

03-20 08:29:08.275: E/Cocos2dxMusic(31653):     at org.cocos2dx.lib.Cocos2dxHelper.playBackgroundMusic(Cocos2dxHelper.java:143)

03-20 08:29:08.275: E/Cocos2dxMusic(31653):     at org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method)

03-20 08:29:08.275: E/Cocos2dxMusic(31653):     at org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:94)

03-20 08:29:08.275: E/Cocos2dxMusic(31653):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)

03-20 08:29:08.275: E/Cocos2dxMusic(31653):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)

03-20 08:29:08.275: E/Cocos2dxMusic(31653): playBackgroundMusic: background media player is null

0 个答案:

没有答案