Hey Kibotu,
This version is not working with Unity 5.4 builds.
I imported your project with latest Unity Classes.jar , on android device while testing(Hit isMusicActive button) its giving below exception.
10-02 10:36:04.482 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.getFmodAudioDevice(OnAudioFocusChangeListenerService.java:184) 10-02 10:36:04.483 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.stopFMOD(OnAudioFocusChangeListenerService.java:159) 10-02 10:36:04.483 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:103) 10-02 10:36:04.483 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:92) 10-02 10:36:04.484 4234-4248/? V/OnAudioFocusChangeListenerService: stopFMOD: fmod == null 10-02 10:36:04.485 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.getFmodAudioDevice(OnAudioFocusChangeListenerService.java:184) 10-02 10:36:04.485 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:120) 10-02 10:36:04.485 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:92) 10-02 10:36:04.589 4234-4248/? I/Unity: AndroidJavaException: java.lang.NullPointerException java.lang.NullPointerException at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:120) at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:92) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.a(Unknown Source) at com.unity3d.player.UnityPlayer$b$1.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at com.unity3d.player.UnityPlayer$b.run(Unknown Source) at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJNISafe.CallStaticBooleanMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJavaObject._CallStatic[Boolean] (System.String methodName, System.Object[] args) [0x00000] in <f
I tried to debug myself and found that the issue is with the below code in OnAudioFocusChangeListenerService class.
private static FMODAudioDevice getFmodAudioDevice() {
final UnityPlayer unityPlayer = ManualUnityActivity.unityPlayer;
if (unityPlayer == null) {
Log("ManualUnityActivity.unityPlayer == null");
return null;
}
try {
final Field r = UnityPlayer.class.getDeclaredField("r");
r.setAccessible(true);
return (FMODAudioDevice) r.get(ManualUnityActivity.unityPlayer);
} catch (final NoSuchFieldException e) {
e.printStackTrace();
} catch (final IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
I think since the strucure of the UnityPlayerActivity class has chnaged in new versions of unity, above code is not able to find the varaibel "r" or FModAudioDevice instance.
So i think now we need some different way to get the FModAudioDevice instace. Not sure how.
I am Attaching the latest files from Classes.jar from Unity, for your reference.
Here is the link https://1fichier.com/?akqf3iyued
Hey Kibotu,
This version is not working with Unity 5.4 builds.
I imported your project with latest Unity Classes.jar , on android device while testing(Hit isMusicActive button) its giving below exception.
10-02 10:36:04.482 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.getFmodAudioDevice(OnAudioFocusChangeListenerService.java:184) 10-02 10:36:04.483 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.stopFMOD(OnAudioFocusChangeListenerService.java:159) 10-02 10:36:04.483 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:103) 10-02 10:36:04.483 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:92) 10-02 10:36:04.484 4234-4248/? V/OnAudioFocusChangeListenerService: stopFMOD: fmod == null 10-02 10:36:04.485 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.getFmodAudioDevice(OnAudioFocusChangeListenerService.java:184) 10-02 10:36:04.485 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:120) 10-02 10:36:04.485 4234-4248/? W/System.err: at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:92) 10-02 10:36:04.589 4234-4248/? I/Unity: AndroidJavaException: java.lang.NullPointerException java.lang.NullPointerException at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:120) at net.kibotu.audiolistener.OnAudioFocusChangeListenerService.isMusicActive(OnAudioFocusChangeListenerService.java:92) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.a(Unknown Source) at com.unity3d.player.UnityPlayer$b$1.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at com.unity3d.player.UnityPlayer$b.run(Unknown Source) at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJNISafe.CallStaticBooleanMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJavaObject._CallStatic[Boolean] (System.String methodName, System.Object[] args) [0x00000] in <fI tried to debug myself and found that the issue is with the below code in OnAudioFocusChangeListenerService class.
I think since the strucure of the UnityPlayerActivity class has chnaged in new versions of unity, above code is not able to find the varaibel "r" or FModAudioDevice instance.
So i think now we need some different way to get the FModAudioDevice instace. Not sure how.
I am Attaching the latest files from Classes.jar from Unity, for your reference.
Here is the link https://1fichier.com/?akqf3iyued