Which jar should I be using?

I keep running into errors that involve Processing functions when I try to port to Android. I use Android Studio and use the Processing IDE to export an Android project, then take the sketch code and insert it into a fragment. The latest error was a fairly simple example from Danel Shiffman’s coding train on Fourier Series. He uses a FloatList called wave and then uses wave.insert(0,y) with y being a float. This gets a red underline in Android Studio.

Android Studio will give me a list of methods I can use for FloatList and insert() shows up twice with one method like this

insert(int i, int[] ints );

The other choice of method like this:

insert(int i, intList intList );

On Processing desktop, FloatList.insert(int,float);

I’m hoping someone can see the problem I have if I try to use Processing in Android and the methods are redefined from what works on the Desktop. I keep running into this type of incompatibility which makes me think the processing-core.jar I’m using in the /libs directory of the project is the problem.

Which .jar should I use to port Processing 3 to Android?

1 Like

I tried something that almost worked. I went to the Processing download link and downloaded what I thought was the necessary processing-core.jar, specifically, processing-core-4.0.4.jar. This had the FloatList.insert(int,float) method which solved one error and caused another. It said it couldn’t convert a PApplet to a Fragment.

Maybe some Code could help go solve this problem. Please post the relevant part of your Code and the exact error message (and maybe tell is the line the error happens at, if you know it).

@HackinHarry ====

try to import (with AS) “from existing code” (not copying) and see what happens…

Hey guys, thanks for the replies. I solved it by accepting that the processing-core.jar file I’m using is limited. In other words, I wrote some code to replace the broken FloatList.insert(int,float) method.

To replace non functional wave.insert(0,y);