Not able to run the code in android mode (AudioContext : no AudioIO specified)

edited March 12 in Android Mode

Not able to run the code in android mode, anyone familiar with error, please help.

This is the code:

import beads.*;
import java.util.List;

AudioContext ac;
WavePlayer wp;
Gain g;
Glide gainGlide;
Glide frequencyGlide;

void setup()
{
   ac = new AudioContext(); 

 gainGlide = new Glide(ac, 40f, 20);
 frequencyGlide = new Glide(ac, 250, 20);
 wp = new WavePlayer(ac, frequencyGlide, Buffer.SINE);
 g = new Gain(ac, 1, gainGlide);
 g.addInput(wp);
 ac.out.addInput(g);
 ac.start(); 
}

This is the error:

AudioContext : no AudioIO specified, using default => beads.JavaSoundAudioIO.
FATAL EXCEPTION: Thread-20174
Process: processing.test.sketch_180311a, PID: 11871
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/sound/sampled/AudioFormat;
    at beads.JavaSoundAudioIO.create(Unknown Source)
    at beads.JavaSoundAudioIO$1.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.sound.sampled.AudioFormat" on path: DexPathList[[zip file "/data/app/processing.test.sketch_180311a-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)
    ... 3 more
    Suppressed: java.lang.ClassNotFoundException: javax.sound.sampled.AudioFormat
        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)
        ... 4 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Answers

  • Edit post, highlight code, press Ctrl-o to format.

    Looks like a missing class. Is the class in the jar? Is it on the classpath? Is it anywhere on the device?

    Have you googled the error?

    Android version? Processing version?

  • I googled it but nothing is there.

  • edited March 13

    @tilak===

    the error code is simple :android does not allow the use of javax.sound; it uses its own; that s why beads or minim cannot work with it

  • (we keep seeing errors like this. should libraries be tagged with the platforms they support somehow?)

  • @koogs===

    could be useful!

  • @tilak - Beads can use alternative audio IO, it's not stuck with using JavaSound. However, I don't think there's an Android audio IO yet - https://github.com/orsjb/beads/issues/15

    The integration is not that difficult to write (I wrote the one for the JAudioLibs JACK bindings).

Sign In or Register to comment.