Android Processing importing Sound library error

Hello everyone!

I have an issue with the Sound library import into the Android Mode. All works fine when in Java Mode, all sounds are playing as they should, but in Android Mode the " import processing.sound.* " line of code gives me the following error:

Exception in thread "Thread-119" java.lang.NullPointerException: Cannot read the array length because "list" is null
	at processing.app.Library.wrapFiles(Library.java:427)
	at processing.app.Library.getApplicationExports(Library.java:437)
	at processing.mode.android.AndroidBuild.copyImportedLibs(AndroidBuild.java:839)
	at processing.mode.android.AndroidBuild.createAppModule(AndroidBuild.java:481)
	at processing.mode.android.AndroidBuild.createProject(AndroidBuild.java:262)
	at processing.mode.android.AndroidBuild.build(AndroidBuild.java:223)
	at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:294)
	at processing.mode.android.AndroidEditor$17.run(AndroidEditor.java:421)

Without the abovementioned line of code, all works well!
What is the problem? Why the Sound library doesn’t work in Android Mode?
I use the Processing 4.3 IDE.
Also the “Thread-119” portion gets changed with other numbers each time I compile my code!

Many thanks,
Sammy

1 Like

I’ve been having an identical error. Have you managed to sort it, or find another Sound library that works on both Android and PC?

  • Josh

@SammySylvester84 @joshuamv I don’t think this is an issue with the Processing Sound library, rather Android Mode in general. It appears that both sound libraries that support Android (P4/Sound and Pd4P3) both throw cryptic errors that seem to be related to importing external libraries.
I can confirm that Pd4P3 works on Android via Android Studio, but not when using Android mode, at least on Windows.
I will report this to the processing-android team.

1 Like

Looks like this was already reported last year. You can see @kevinstadler’s fix at the bottom. I haven’t confirmed it that works or not.
Cannot build Android Mode sketch that uses any native code libraries · Issue #738 · processing/processing-android (github.com)

1 Like

I had a lot of problems with the Sound Library.
I removed the existing Sound library and downloaded the last version of Processing-Sound from github (Download the zip file and extract it into the Processing Library Directory). You can run the sketches from “Examples” to check if they run correctly.

Hi!

I removed the existing Sound library and downloaded the latest version of Processing-Sound from Github as you adviced, but it gives me an error when adding a Sound File (“The class SoundFile does not exist”). After an online research, it seems that the Processing IDE needs a “.jar” file inside library folder of this extracted folder to recognize Sound Files and this zip folder from Github doesn’t have it. I opened an issue with this subject on Processing-Sound Github page and I am waiting for an answer.

What about you? Have you managed to play a Sound File with this downloaded folder?

Thanks!
Sammy

Not yet! :frowning:
What about you? :slight_smile:

No success either… :frowning:

Hi
Yes, I wrote a few sketches and they work.
If you use a Sound File it must be in .aiff format.
Try to run the example “Sampler” Under IDE/File/Examples/Libraries/Sound/Sound/Soundfile/Sampler
and check if it works.

Thanks for these solutions, MPROCD and Sammy. I’ve moved my current project from Processing to p5.js in part because of the sound for Android issue, and in part just to make the whole project browser-based and therefore easier for cross-platform. But if/when I come back to prototyping something new in Processing, I’ll keep this sound option in mind.

1 Like

It doesn’t work… :frowning: It’s giving me the same error message like in the beginning… The strange fact is that at the beginning of the year sound worked fine in Android Mode. I don’t know what happened in the mean time… :expressionless:

Are you sure you were using the Android Mode? :thinking: :thinking:

Yes.
Try to;

  • Remove the Sound Library: Load your sketch/IDE/Sketch/Import Library/Select Sound/Remove
  • Check your Libraries folder, if still includes a Sound library delete this Sound library.
  • Download the ZIP file of latest version of Processing-Sound from Github.
  • Extract it to your Libraries Directory
  • Check that this Directory includes now a Sound subdirectory under which you can find Examples/Soundfile
  • Restart your computer
  • Try to run your sketch under Processing and if O.K, under Android

Good luck

Hi everyone! :slight_smile:
After trying all kind of versions, I’ve managed to get Android Sound working by downloading this folder from Github. It works only with WAV or AIF file formats in both Java and Android Mode, but for me this is better than nothing, since I can convert online MP3 files to WAV files at anytime.
So I think this is the best solution I found so far and my project works now very well with this library, so I recommend it to you as well! :slight_smile:

Good luck and have fun!
Sammy

Hello
See my post from August 29.

1 Like

Where have you posted on August 29? :thinking::thinking:

Under Category Processing for Android, see Post title: Problems with Sound Library in Android by MPROCD. Under this post see sub post dated Aug 29, beginning with: Problem solved.
Good luck

1 Like

Yes, I tried that too, but it didn’t work for me. Don’t know why… :frowning: But I am good with the current result. :slight_smile: The guy that uploaded the folder I was talking about asked me very precisely what folder worked and what folder didn’t. He seemed to be in charge with Android Processing and he was the one that made changes to the initial folder, so I believe he will make the necessary adjustments for Android Sound to work better in the future!
So I recommend all of you to put questions on Github or anywhere if you have issues of any kind, because all improvements can be possible if you tell exactly what are you dealing with! :slight_smile:

Wishing you all the best,
Sammy