Using Sound in Android

I’m trying to use apwidgets and I don’t understand why what I’m doing isn’t working.
I downloaded and extracted it, and moved the apwidgets folder into the libraries folder for processing.
The gist of my code is this:

import apwidgets.*;
APMediaPlayer player;

void setup() {
    player = new APMediaPlayer(this);
public void onDestroy() {
  if (player!=null) {

There are no errors in processing itself, but when I run it, I get this error:

FATAL EXCEPTION: Animation Thread
Process: xyz.crispycabot.hold_the_touch, PID: 18688
java.lang.NoSuchMethodError: No virtual method getAssets()Landroid/content/res/AssetManager; in class Lprocessing/core/PApplet; or its super classes (declaration of 'processing.core.PApplet' appears in /data/app/xyz.crispycabot.hold_the_touch-oLOKRaPnDnSce8vCYHCoEA==/base.apk)
	at apwidgets.APMediaPlayer.setMediaFile(
	at xyz.crispycabot.hold_the_touch.Hold_The_Touch.setup(
	at processing.core.PApplet.handleDraw(Unknown Source:75)
	at processing.core.PSurfaceNone.callDraw(Unknown Source:19)
	at processing.core.PSurfaceNone$ Source:55)

1 Like

I don’t think it is receiving any maintenance. Can you see if there is any date related to when it was last modified? Did you get it from github or from other repo? Check the old forum for MediaPlayer sample codes.


apwidgets does not work anymore(since 2 or 3 years) with P5…

1 Like

@akenaton Is there any way I could so sound then? That’s the only thing I could find that appeared to work