Open
Description
Suppose I have a sketch that simply plays a sound when the screen is pressed:
import processing.sound.*;
SoundFile file;
void setup() {
file = new SoundFile(this, "barrel_hop.wav");
}
void mousePressed() {
file.play();
}
void draw() {
}
While this works as expected on my Windows 10 PC, running the same sketch on my Android 5.1 Moto E device shows the following error in the console log and does not play any audio when the screen is pressed:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/media/AudioRecord$Builder;
at processing.sound.JSynAndroidAudioDeviceManager$AndroidAudioInputStream.start(Unknown Source)
at com.jsyn.engine.SynthesisEngine$EngineThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.media.AudioRecord$Builder" on path: DexPathList[[zip file "/data/app/processing.test.soundexample-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 2 more
Suppressed: java.lang.ClassNotFoundException: android.media.AudioRecord$Builder
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 3 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
This is also using Processing 3.5.4 with Android Mode 4.2.1 installed in the Contribution Manager.
I've found an existing question on the Processing Discourse which very closely matches the error I'm seeing here, but it doesn't have any replies.
So my questions are:
- Is this an Android version issue? From what I understand, Android 5.1 is very old, so it could be that using a more modern version of Android might turn out to be a valid fix.
- If this issue has been observed before, is there a workaround? I haven't found anything related to this particular error in the current set of opened & closed issues, so a fix may have been reported elsewhere.