Processing in android studio with androidx support

The latest version of android studio use new androidx support library as default.
You could still refactor to AppCompat but it is not recommended and one day it will be completely deprecated.
The android version of processing still use AppCompat, but even you enable legacy support, it still won’t work in androidx environment.
Here’s the solution.

I migrated the latest version “Aug 5, 2019 commit 19c6d03” to androidx.
(ONLY core library)

For your convenience, https://drive.google.com/open?id=1Vcv06UTqrwIZ6K74oXo4dr0cDspYc6D8

Let me know if you find any bug.

3 Likes

I am getting the error below. It seems I cannot yet use P3D mode because the app works when I just use regular java 2d renderer.

java.lang.NullPointerException: Attempt to invoke virtual method ‘java.io.InputStream java.net.URL.openStream()’ on a null object reference

at processing.opengl.PGL.loadVertexShader(PGL.java:1896)
at processing.opengl.PGraphics2DX.getShader(PGraphics2DX.java:1742)
at processing.opengl.PGraphics2DX.flushBuffer(PGraphics2DX.java:1676)
at processing.opengl.PGraphics2DX.textureImpl(PGraphics2DX.java:1804)
at processing.opengl.PGraphics2DX.textCharModelImpl(PGraphics2DX.java:1089)
at processing.opengl.PGraphicsOpenGL.textCharImpl(PGraphicsOpenGL.java:3790)
at processing.core.PGraphics.textLineImpl(PGraphics.java:3821)
at processing.opengl.PGraphicsOpenGL.textLineImpl(PGraphicsOpenGL.java:3740)
at processing.core.PGraphics.textLineAlignImpl(PGraphics.java:3811)
at processing.opengl.PGraphicsOpenGL.text(PGraphicsOpenGL.java:3653)
at processing.core.PApplet.text(PApplet.java:9020)
at xds.rq2.integrationtest1.Visualizations.SketchMaster.drawWarnings(SketchMaster.java:832)
at xds.rq2.integrationtest1.Visualizations.SketchMaster.draw(SketchMaster.java:333)
at processing.core.PApplet.handleDraw(PApplet.java:1901)
at processing.opengl.PSurfaceGLES$RendererGLES.onDrawFrame(PSurfaceGLES.java:264)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1535)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

It might be I forgot include the shader folder. Open the jar as zip file, and put this folder inside.
1

If the problem still existed, I will suggest you to try using the official build in android studio, you need to refactor to AppCompat or use older version of android studio.

1 Like

Thanks! I think it works for me now with P3D mode. Doing further testing.
I placed the updated jar file here:

Good to hear! Hahhhhh.

Their have been some updates since the converted commit in August. Would you be able to provide the .java source files so the community can keep up with the latest changes in adapting the library to androidx?

Hi technew,
i really appreciate it very much that you updated the files to the new androidx libraries, because i have been strugling with that for the past 4 days. I would really like to know how you managed to do that, so if you are willing to explain it to me(via discord or in the comments idk which way would be the best)
i would be very very grateful. :grin: :grin: :grin: :grin:

I am very interested in how this is going to work out, migrating to androidx has been a nightmare…

Just tried the download, it totally works! Thanks @technew and @artRenewal

Is there any official Processing support for this going forward? You know how Android loves to depreciate stuff…

@Midas
@tomjuggler

You guys are welcome.
I might update androidx version to match the lastest github version in recent time depends on my other workflow.

1 Like