# Processing in android studio with androidx support

**URL:** <https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819>\
**Category:** Processing for Android\
**Created:** [September 5, 2019, 8:31am UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819 "2019-09-05T08:31:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![technew](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/technew/32/6364_2.png) [@technew](https://discourse.processing.org/u/technew)\
**Post date:** [September 5, 2019, 8:31am UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/1 "2019-09-05T08:31:46Z")

</div>

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](https://github.com/processing/processing-android/commit/19c6d035dc08398c445dfd33b676eeb04df28b01)” to androidx.  
(ONLY core library)

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

Let me know if you find any bug.

---

<div class="post-metadata">

**Author:** ![artRenewal](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@artRenewal](https://discourse.processing.org/u/artRenewal)\
**Post date:** [September 11, 2019, 6:46pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/2 "2019-09-11T18:46:34Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![technew](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/technew/32/6364_2.png) [@technew](https://discourse.processing.org/u/technew)\
**Post date:** [September 11, 2019, 7:16pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/3 "2019-09-11T19:16:47Z")

</div>

It might be I forgot include the shader folder. Open the jar as zip file, and put this folder inside.  
 ![1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/ca2b1b86e61449f9cb99e232dc5edfcca93bc0aa.png)

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](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a017aba95d359309a94b4a7cf439ad547f6b1047.png)

---

<div class="post-metadata">

**Author:** ![artRenewal](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@artRenewal](https://discourse.processing.org/u/artRenewal)\
**Post date:** [September 11, 2019, 8:11pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/4 "2019-09-11T20:11:25Z")

</div>

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

> **[android\_core\_assets.jar](https://drive.google.com/file/d/1-py9UrH373HUvEkTyu3Gxutu3nab-eMp/view?usp=drive_open)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![technew](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/technew/32/6364_2.png) [@technew](https://discourse.processing.org/u/technew)\
**Post date:** [September 11, 2019, 8:21pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/5 "2019-09-11T20:21:33Z")

</div>

Good to hear! Hahhhhh.

---

<div class="post-metadata">

**Author:** ![artRenewal](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@artRenewal](https://discourse.processing.org/u/artRenewal)\
**Post date:** [December 11, 2019, 7:42pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/6 "2019-12-11T19:42:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Midas](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Midas](https://discourse.processing.org/u/Midas)\
**Post date:** [January 11, 2020, 9:45pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/7 "2020-01-11T21:45:59Z")

</div>

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. 😁 😁 😁 😁

---

<div class="post-metadata">

**Author:** ![tomjuggler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tomjuggler/32/809_2.png) [@tomjuggler](https://discourse.processing.org/u/tomjuggler)\
**Post date:** [May 6, 2020, 12:42pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/8 "2020-05-06T12:42:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tomjuggler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tomjuggler/32/809_2.png) [@tomjuggler](https://discourse.processing.org/u/tomjuggler)\
**Post date:** [May 6, 2020, 2:53pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/9 "2020-05-06T14:53:38Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![technew](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/technew/32/6364_2.png) [@technew](https://discourse.processing.org/u/technew)\
**Post date:** [May 12, 2020, 12:25pm UTC](https://discourse.processing.org/t/processing-in-android-studio-with-androidx-support/13819/10 "2020-05-12T12:25:50Z")

</div>

@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.
