# Paying basic sounds in android, fail NoClassDefFoundError

**URL:** <https://discourse.processing.org/t/paying-basic-sounds-in-android-fail-noclassdeffounderror/14546>\
**Category:** Processing for Android\
**Created:** [October 9, 2019, 11:56am UTC](https://discourse.processing.org/t/paying-basic-sounds-in-android-fail-noclassdeffounderror/14546 "2019-10-09T11:56:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)\
**Post date:** [October 9, 2019, 11:56am UTC](https://discourse.processing.org/t/paying-basic-sounds-in-android-fail-noclassdeffounderror/14546/1 "2019-10-09T11:56:44Z")

</div>

Hi people;

I think this is a really nooby error but I don’t know how to fix it… And reading in some places I’m not able get the solution (and inside processing forum, nearly all topics about sounds are on loaded sounds, I want somehing simplier if possible 😅).

Well, I want to play sounds, but not loaded sounds, just anyone to make a warning. I tried to use the pulse:

> **Example**
>
> ```auto
> import processing.sound.*;
> int flag=1;
> float ancho = 0.05,cont =0;
> 
> Pulse a = new Pulse(this);
> Sound s = new Sound(this);
> 
> void setup() {
> size(displayWidth, displayHeight);
> s.volume(1);
> a.width(0.05);  
> }
> 
> void draw() {
> background(0);
> cont++;
> if(cont < 40)
> a.freq(3500);
> else{
> a.freq(4000);
> if (cont >=100)
> cont = 0;
> }
> if(flag == 1)
> a.play();
> else if (flag == -1)
> a.stop();  
> }
> 
> void mousePressed(){
> flag *= -1;   
> }
> 
> ```

And it works fine in java mode, and in android mode, even exporting to AS (Android Studio), but my problem is when I want to put it in my code (in AS)…

I have imported the library (or at least I think so [copy the sound library from the exported code to AS to my AS project]), and added to my code this:

> **Think is not relevant**
>
> ```auto
> import processing.sound.*;
> 
> public class HMI_Scene extends PApplet {
> [...]
> Pulse sonidoAlertas = new Pulse(this);
> Sound sonidoParaVolumen = new Sound(this);
> 
> public void setup() {
> [...]
> sonidoParaVolumen.volume(1);
> sonidoAlertas.width((float)0.05);
> }
> public void draw() {
> [...]
> sonidoAlertas.play();
> }
> 
> ```

The error I’m getting is:

> **java.lang.NoClassDefFoundError:**
>
> ```auto
> java.lang.NoClassDefFoundError: Failed resolution of: Lcom/jsyn/unitgen/PulseOscillator;
> at processing.sound.Pulse.<init>(Unknown Source)
> ...HMI_Scene.<init>(HMI_Scene.java:92)
> at ...HMI.onCreate(HMI.java:115)
> at android.app.Activity.performCreate(Activity.java:6320)
> at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2530)
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2665)
> at android.app.ActivityThread.-wrap11(ActivityThread.java)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499)
> at android.os.Handler.dispatchMessage(Handler.java:111)
> at android.os.Looper.loop(Looper.java:207)
> at android.app.ActivityThread.main(ActivityThread.java:5765)
> at java.lang.reflect.Method.invoke(Native Method)
> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
> Caused by: java.lang.ClassNotFoundException: Didn't find class "com.jsyn.unitgen.PulseOscillator" on path: DexPathList[[zip file "/data/app/.../base.apk"],nativeLibraryDirectories=[/data/app/.../lib/arm64, /vendor/lib64, /system/lib64]]
> at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
> at processing.sound.Pulse.<init>(Unknown Source) 
> at ...HMI_Scene.<init>(HMI_Scene.java:92) 
> at ...HMI.onCreate(HMI.java:115) 
> at android.app.Activity.performCreate(Activity.java:6320) 
> at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2530) 
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2665) 
> at android.app.ActivityThread.-wrap11(ActivityThread.java) 
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499) 
> at android.os.Handler.dispatchMessage(Handler.java:111) 
> at android.os.Looper.loop(Looper.java:207) 
> at android.app.ActivityThread.main(ActivityThread.java:5765) 
> at java.lang.reflect.Method.invoke(Native Method) 
> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
> Suppressed: java.lang.ClassNotFoundException: com.jsyn.unitgen.PulseOscillator
> 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)
> ... 16 more
> Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
> 
> ```

> **This are my dependecies from my build.gradle files:**
>
> ```auto
> 
> implementation fileTree(include: ['*.jar'], dir: 'libs')
> implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
> implementation 'com.android.support.constraint:constraint-layout:1.1.3'
> testImplementation 'junit:junit:4.12'
> androidTestImplementation 'com.android.support.test:runner:1.0.2'
> androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
> api project(':...')
> 
> ```

And well, **what I really want is to make a sound to warn the user,** don’t care if it is from an specific library, but I would like it not to be a loaded sound, because it would ralentize my app, in order to get this, I tried the case I have written, but I have the NoClassDefFoundError… If you, preciated reader, can help me to fix my error, or give me another solution, It will be fantastic 🤗

---

<div class="post-metadata">

**Author:** ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)\
**Post date:** [October 14, 2019, 8:59am UTC](https://discourse.processing.org/t/paying-basic-sounds-in-android-fail-noclassdeffounderror/14546/2 "2019-10-14T08:59:03Z")

</div>

OOuuuh yeah, thanks to @Hubbit200  
[This solved my problem too](https://discourse.processing.org/t/audio-issues-help-please/14402/18) 🤗🤗🤗
