Problems with Latest Nightly (AudioRenderer in AndroidHarness onPause)

As of yesterday (I think) I have a problem with the latest nightly build. I’m compiling from source and grabbed the latest from SVN.



AndroidHarness

When the app closes (after hitting ok on the alert box to exit the game) I get the following:

[java]

02-17 13:23:50.554 21476 21493 I com.jme3.scene.Node: INFO Node 1:23:50 PM Gui Node (Node): Child removed.

02-17 13:23:50.554 21476 21493 I com.jme3.scene.Node: INFO Node 1:23:50 PM Gui Node (Node): Child removed.

02-17 13:23:50.554 21476 21493 I MenuScreens: MenuScreens cleanup

02-17 13:23:50.554 21476 21493 I MenuScreens: World cleanup

02-17 13:23:50.554 21476 21493 I OGLESContext: Display destroyed.

02-17 13:23:50.624 21476 21476 I AndroidHarness: pause: AndroidAudioRenderer

02-17 13:23:50.624 21476 21476 W dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4001e560)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: FATAL EXCEPTION: main

02-17 13:23:50.632 21476 21476 E AndroidRuntime: java.lang.RuntimeException: Unable to pause activity {com.interstatewebgroup.ballchucker/com.interstatewebgroup.ballchucker.MainActivity}: java.lang.NullPointerException

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2492)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2439)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2419)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.ActivityThread.access$1700(ActivityThread.java:124)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.os.Looper.loop(Looper.java:130)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:3821)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:507)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: Caused by: java.lang.NullPointerException

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at com.jme3.audio.android.AndroidAudioRenderer.pauseAll(AndroidAudioRenderer.java:416)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at com.jme3.app.AndroidHarness.onPause(AndroidHarness.java:250)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.Activity.performPause(Activity.java:3931)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2474)

02-17 13:23:50.632 21476 21476 E AndroidRuntime: … 12 more



[/java]

I kinda fixed this, this afternoon (at least i prevented it from crashing the app with a null check) i didn’t investigate, but the audioRenderer should not be null.

I think soundPool in AndroidAudioRenderer is null. Crash went away with a null check in pauseAll:

[java]

public void pauseAll() {

if (soundPool != null) {

soundPool.autoPause();

for (MediaPlayer mp : musicPlaying.values()) {

mp.pause();

}

}

}



[/java]



I don’t think the initialize routine is ever called because I’m not using any audio so soundPool never gets initialized.

[java]

@Override

public void initialize() {

soundPool = new SoundPool(MAX_NUM_CHANNELS, AudioManager.STREAM_MUSIC,

0);

soundPool.setOnLoadCompleteListener(this);

}



[/java]

1 Like

Yeah in fact i fixed it on the onPause and the onResume because there was this issue too.

I’ll commit your changes.

thanks once again :wink: