Closed rublinetsky closed 7 years ago
I haven't tested on Android 7. Judging by your link above, the obvious fix is to include copies of libsonivox.so in the app in the relevant folders. I will build a new release with copies of the library included. I think there is an element of bloody mindedness by Google in that in that there has been an issue raised about the lack of a streaming midi API in Android since 2010. https://code.google.com/p/android/issues/detail?id=8201.
I have updated the NDK/SDK version (master), which just worked. The gradle version (smarek) fails to compile with an apparently unrelated error. I updated the gradle build script to the latest version which then fails with a different apparently unrelated error. Work in progress...
I have released a new version with updated .aar files. These files contain extra spurious copies of libsonivox.so added by the gradle plugin. I can't find a way of stopping it. They can be removed with 7-Zip, or any other zip tool that will open the .aar files.
Bill, thank you for the quick turnaround. I tried to use the new MidiDriver-all-release.aar on a Nexus 5X running Android 7.0 and I am getting basically the same error:
A/art: art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.LinkageError: dlopen libsonivox.so failed
A/art: art/runtime/java_vm_ext.cc:470] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
A/art: art/runtime/java_vm_ext.cc:470] at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1060)
A/art: art/runtime/java_vm_ext.cc:470] at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.String) (Runtime.java:975)
A/art: art/runtime/java_vm_ext.cc:470] at void java.lang.System.loadLibrary(java.lang.String) (System.java:1530)
A/art: art/runtime/java_vm_ext.cc:470] at void org.billthefarmer.mididriver.MidiDriver.<clinit>() (MidiDriver.java:42)
...
The error occurs at the following line in my code
midi = new MidiDriver();
The same build runs fine on Android 5.1.1 (both - real devices, not emulators)
I looked inside the APK and libsonivox.so is included inside each of the /lib/[platform] folders
Here is how I installed it - I completely deleted the old version directory from the project tree (it contained AAR, gradle file, and IML file), and removed the dependency from the app settings. Then I used Android Studio's File->New Module->Import AAR/JAR to import the MidiDriver-all-release.aar from inside the https://github.com/billthefarmer/mididriver/releases/download/v1.07/Mididriver-1.07.aar.zip. I haven't change my application code.
Am I doing something wrong?
I was able to reproduce the issue on emulators - works with Android 6 and fails on Android 7.
I have done some testing with this issue. The libsonivox.so files should end up with the libmidi.so files in lib/[platform] like you said.
Unfortunately, I get a pop-up that complains about unauthorized access to libutils.so and libutils.so from libsonivox.so, with entries in the log.
09-28 09:37:27.137 1478 1727 I ActivityManager: Start proc 2729:org.billthefarmer.mididriver/u0a62 for activity org.billthefarmer.mididriver/.MainActivity
09-28 09:37:27.500 2729 2729 W linker : library "libutils.so" ("/system/lib/libutils.so") needed or dlopened by "/data/app/org.billthefarmer.mididriver-1/lib/x86/libsonivox.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
09-28 09:37:27.500 2729 2729 W linker : library "libcutils.so" ("/system/lib/libcutils.so") needed or dlopened by "/data/app/org.billthefarmer.mididriver-1/lib/x86/libsonivox.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
09-28 09:37:28.734 1478 1500 I ActivityManager: Displayed org.billthefarmer.mididriver/.MainActivity: +1s609ms
I can't see a way around it other than rebuilding the sonivox library so it doesn't use unsupported libraries. Or using an alternative midi library like FluidSynth.
New version released which includes rebuilt Sonivox library and includes 64 bit native code as Google have fixed the reverb bug.
Hi Bill,
Sorry for bugging, I have the same error message as I run the debug process on my Android 8 (OREO Go) device. What can I do to solve it? I've been using Sonivox since Android 4, using FluidSynth is not a good idea. Thank you for your time and reply.
The latest versions of the driver have the Sonivox synthesizer built in to solve the above problems. You should be using it via JitPack.
The code that runs fine on Android 5.1.1 fails on Android 7.0. The error is:
Seems to be related to the following change in Android: https://developer.android.com/about/versions/nougat/android-7.0-changes.html#ndk
Any workaround suggestions are greatly appreciated.