Android Programming for Beginners

Hello folks!

I haven’t programmed for Android in several years and only dabbled when I did.

In the past, I’ve used:

I actively engage with the broader programming community (outside this forum) and provide general instruction, including Processing. I’d like to expand that instruction to include Android development as well, starting with Processing-based tools.

Every time I return to Android programming, it feels like starting from scratch. New versions, setup issues, and tooling changes can be a bit of a hurdle.

Any general guidance to help get up and running quickly would be appreciated. Our communities benefit from shared experience, especially when it comes to keeping things accessible for beginners.

I’m an autodidact and will figure it all out in due time… but I don’t have that time right now.

I’m sharing this topic on behalf of some passionate learners who are following along but do not have permission to post themselves.

Please direct responses to the community visiting here rather than just me.

Kindly tailor your responses to be beginner-friendly for those new to Android programming using Processing.

I will also respond to this as my exploration unfolds.

:blush: This thread can serve as a useful resource for everyone and especially beginners.

:japanese_symbol_for_beginner: KISS Keep it Super Simple

*** UPDATE ***

Please clearly state your development environment when providing feedback.
This is good advise for any topic.
Each OS (Operating System) may have its unique issues.
With each new update things change and this helps navigate the waters.

For example:

Development environment:

  • Windows 10
  • Processing 4.4.4
  • Motorola Android Phone (Android version 14)
  • Android Mode for Processing 4.6.1 (Installed July 28).
  • I did an SDK update

Thanks!

:)

Is this simple enough:

void setup() {
  fullScreen();
  background(209);
  fill(0, 255, 0);
  rect(200,200,400,400);
}

void draw() {  
}

But don’t try to run this on the latest Processing version 4.4.4 because it no longer works in Android mode and is a known issue. Instead use version 4.3 to get it to work. In my opinion the user needs to use Android Studio and Processing in tandem. Android Studio mainly just helps in getting the right files in the right places. It’s more complicated than it needs to be but we’ve been told that it’s being worked on and I’m sure that it’s not easy from a developer standpoint. That said Processing with Android mode is still far easier to use than the alternative in my opinion and I would like to see a lot more future development in this area by our programmers. One of the problems is what to use for ‘widgets’. It’s fun to create your own but the good ones are created using official Android Developer code which is of course more complicated. There have been several published examples, eg GitHub - vsquared/AndroidWidgets_Processing4: Android controls for use in Processing 4.1.1 Android mode. Device is 10" Samsung tablet in landscape orientation.

Thanks for the feedback.

I found your issue on GitHub here:
Android mode no longer works in Processing 4.4.1 · Issue #777 · processing/processing-android · GitHub

The GitHub issue is for a MacOS and does not mention Windows.

I did a Windows test with this configuration:

  • Windows 10 Pro Version 22H2
  • Processing 4.4.4
  • Motorola Android Phone (Android version 14)
  • Android Mode for Processing 4.6.1 (Installed July 28).
  • I did an SDK update from the Processing menu.

It seemed to work out of the box:

I was not able to get the emulator working in Android Mode for Processing 4
Not yet!

Code
void setup() {
  // Use full screen mode
  fullScreen(P3D);
  noStroke();  // Optional: Remove stroke for 3D objects
}

void draw() {
  background(0);  // Set background to black
  
  lights();
  
  // Move the origin of the coordinate system to the center
  translate(width / 2, height / 2, 0); 
  
  // Rotate the box over time
  rotateX(frameCount * TAU/360); 
  rotateY(frameCount * TAU/360); 

  // Draw a 3D box
  fill(255, 0, 0);  // Red color for the box
  box(200);  // Draw a 3D box with size 200 units
}
Console output
Build folder: D:\temp\android643224006342175877sketch
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33

This Android Gradle plugin (7.1.0) was tested up to compileSdk = 32

This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:javaPreCompileDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:checkDebugAarMetadata
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets
> Task :app:compressDebugAssets
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:checkDebugDuplicateClasses
> Task :app:mergeDebugJniLibFolders
> Task :app:mergeDebugNativeLibs NO-SOURCE
> Task :app:stripDebugDebugSymbols NO-SOURCE
> Task :app:validateSigningDebug
> Task :app:writeDebugAppMetadata
> Task :app:writeDebugSigningConfigVersions
> Task :app:processDebugManifestForPackage
> Task :app:mergeDebugResources
> Task :app:processDebugResources
> Task :app:desugarDebugFileDependencies

> Task :app:compileDebugJavaWithJavac
Annotation processing got disabled, since it requires a 1.6 compliant JVM

> Task :app:dexBuilderDebug
> Task :app:mergeDebugJavaResource
> Task :app:mergeExtDexDebug
> Task :app:mergeDexDebug
> Task :app:packageDebug
> Task :app:createDebugApkListingFileRedirect
> Task :app:assembleDebug

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 8s
27 actionable tasks: 27 executed
Exploration < Click to expand!

Related posts:

Additional references:

:)

For what it’s worth …

I too started Android development using Processing, about 12 years ago. My specific area of interest was (still is) audio/music but I needed a relatively easy means of creating a GUI and at this, Processing excels! It was my basic introduction to Java coding and it was easy to get quick results!

Beyond the GUI though I had to delve into contributed libraries (Ketai, Minim etc) but as Processing developed, I found that Ketai/Minim were never maintained to support upgrades etc and similarly with a few other contributed libraries, so eventually I took the plunge and exported my Processing sketches and set them up in Android Studio. The basic lesson learnt was that you SHOULDN’T use contributed libraries. As good as they may be, unless they are maintained in line with Processing developments, they will likely at some point stop working.

Moving to Android Studio was a real game changer. Once I’d figured out that I still had setup() and draw() I could just carry on using them as before. No need to bother with XML layouts etc as you have the full screen still as your canvas and can do what you like with it. The big advantage though was discovering I could make use of the much fuller capabilities of the Android SDK for audio … MediaPlayer, AudioTrack etc. And once you know how to read into the SDK you can find all sort of other useful stuff. I then found that all this can also be done in Processing too so perhaps not quite the game changer I initially thought it might be! The point though is that it expanded my horizons and now I can do both. I still use Processing for sketching ideas but then shift to Android Studio to finish.

The biggest issue though re Processing vs Android Studio is the lag in development of Processing Android Mode to keep pace with the ever/regular/often rule changes that Google introduces … SD Card access permissions… minimum and target SDK requirements if you want to put anything on Google Play. It’s a bit more effort to keep track of SDK target and version numbers but not difficult once you know which files to edit.

If you do export to Android Studio, you will also discover that Processing has hidden from you the onCreate(), onStart(), onResume(), onPause(), onStop() and onDestroy() methods that define an android app lifecycle … and if you are teaching android development then you should know about them.

What else do you want to do beyond displaying cool graphics?
Do you want to be able to play audio?
Do you want to be able to access file storage?
Do you want to learn about the android app lifecycle?

Do your learners just want to code and deploy to just their own device or do they want to publish on Google Play and learn more about Android? If the latter get set up in Android Studio. If the former then use Processing but accept its limitations.

2 Likes

Hello @shedMusic ,

Thank you for the feedback.

My development journey was similar to yours but very limited in scope and time spent on this.
I would test the waters and get some simple projects up and running.

It is early days yet and will start with Android Mode for Processing and focus on that before taking any next steps.

My current Windows 10 development environment:

  • Windows 10 Pro Version 22H2
  • Processing 4.4.4
  • Motorola Android Phone (Android version 14)
  • Android Mode for Processing 4.6.1 (Installed July 28).
  • I did an SDK update from the Processing menu.

I got a simple example working (see previous posts).

Are you aware of any known issues for this?
Can you test and confirm?

I was not able to get the emulator working in Android Mode for Processing 4.
I did get it to launch manually to see if it was working… but not in Android Mode with a Processing sketch.

Other operating systems (MacOS, Linux, etc.) would be a separate discussion.

:)

I use a MacBook but have access to a PC … I’ll set it up and get back to you :+1:

1 Like

Yet!

Topic here:

:slight_smile:

Hi

Just been tying to download to a borrowed windows 10 laptop but can’t even do that …. bombs out at around 265MB .. tried 3 times. I do have a pc with all this installed but it’s in storage while I move house…

I’ll post some thoughts re android though based on my MacBook coding which should be the same in terms of how it all works, but I think I’ll leave the PC until later in August.

1 Like

I just tried the test sketch from my initial post on a Windows 11 system using Processing 4.4.4 (Android Mode latest 4.6.1) and it failed with the following error (same as what I saw on Mac M2 with Samsung A8 device). Sorry that I had to post an image of the console output, but Processing won’t allow me to copy console output.

1 Like

@svan Thanks for testing this.

It failed for me with this development environment:

  • Windows 11
  • Processing 4.4.4 or Processing 4.3.4 < Each had a different issue!
  • Motorola Android Phone (Android version 14)
  • Android Mode for Processing 4.6.1 (Installed July 28).

I even went as far as deleting the .gradle folder between test installs.

My Windows 11 PC is a fresh and recent install.

This made wonder if I had other stuff already in W10 supporting a successful build.

In Windows 10 I deleted these before installing:

  • preferences.txt Each install keeps adding to PATH
  • android folder
  • .gradle folder (this was new!)
  • any open occurrences of Processing or OpenJDK running
  • I miss anything?

And it installed successfully and I was able to build and run sketches on my phone successfully.

I won’t be drawing any conclusions too soon without more testing.
I won’t be doing testing any time soon.

*** UPDATE for Windows 11 ***

I went back to revisit this and it now works with Processing 4.3.4
This was after I added it and allowed it through the firewall.
I also deleted the .gradle again too.
I also did not reopen existing code (with all the extra stuff in sketch folder) and tested with a new sketch and cut and paste into it.
I will revisit this again to see what exactly made it work.

I will generate some best practices for this at some point.

:)

Similar issue with 4.4.4 on Mac … same error as already posted and confirms issue #777 on GitHub. Seems like this will stay broken in the foreseeable future so I just went back to 4.3.4

Works on:

  • MacBook Air (M2)

  • Processing 4.3.4

  • Motorola Android Phone (Android version 13)

  • Android Mode for Processing 4.6.1

I can’t see any benefit to using 4.4.4 for Android development in Processing.

In Android Studio I’m still using a now very old 3.5 version and it’s a breeze :exploding_head:

1 Like

*** UPDATE 1 ***

When you install software on a system with a lot of baggage it may impact your current install.

This is important to know even for beginners!
I will impact you at some point.

Baggage in this case is from previous installs:

  • environment variables
  • multiple versions of Java
  • multiple versions of Processing
  • .gradle folder
  • preferences.txt
  • registry
  • Anything I missed!

Working Windows 10 development environment for my personal use:

  • Windows 10 Pro Version 22H2
  • Processing 4.4.4 (portable version) I do not use MSI install.
  • Motorola Android Phone (Android version 14)
  • Android Mode for Processing 4.6.1 (Installed July 28).
  • I did an SDK update from the Processing menu.
  • OpenJDK with PATH set in environment variables

With OpenJDK installed:

C:\Users\GLV>java -version
openjdk version “17.0.15” 2025-04-15
OpenJDK Runtime Environment Temurin-17.0.15+6 (build 17.0.15+6)
OpenJDK 64-Bit Server VM Temurin-17.0.15+6 (build 17.0.15+6, mixed mode, sharing)

When I removed the PATH in the environment variables it failed!

I tried to be rigorous testing this and will revisit another day.
This is currently working but still subject to further testing.

Windows 11 I am leaving for future exploration.
I want to see if an OpenJDK install works there.
May test other PATH settings to Processing as well.
Another day!

*** UPDATE 2 ***

Same day!

These were in some of the errors I saw in console when there were fails:

Caused by: net.rubygrapefruit.platform.NativeException: Could not start ‘C:\WINDOWS\system32\java.exe’

Caused by: java.io.IOException: Cannot run program “C:\WINDOWS\system32\java.exe” (in directory “C:\Users\GLV.gradle\daemon\7.2”):

This seemed to work (corrects above?) in environment user variables as well (replaced OpenJDK PATH) and points directly to folder with java.exe:

image

*** UPDATE 3 ***

I just had to test this!

Working Windows 11 development environment for my personal use:

  • Windows 11 Pro
  • Processing 4.4.4 (portable version) I do not use MSI install.
  • Motorola Android Phone (Android version 14)
  • Android Mode for Processing 4.6.1 (Installed July 28).
  • I did an SDK update from the Processing menu.
  • No other Java versions
  • This is a recent fresh install of Windows 11 so little baggage except Microsoft bloat.
  • Path in Environment Variables set to:

C:\Programs_Portable\Processing\app\resources\jdk\bin

This will be different for your system!

I am cautiously optimistic that this may be solution for getting Android Mode for Processing (4.6.1) to work with Processing (4.4.4) on W10 and W11.

This will require additional testing + validation + process checks.

@stefterv @sableraph
What do you think?
Initial testing seems to indicate that this may work.

*** UPDATE 4 ***

I removed any environment variables I set for testing.

Launching it from a batch file works for me for W10 and W11.
Paths MUST be correct for your system setup.

@svan Want to give it a try?

I can run the batch file to launch Processing 4.4.4 with Android Mode 4.6.1 and do not have to hardcode it into Windows environment variables.

Launch.bat:

@echo off
set JAVA_HOME=D:\Program_Portable\Processing-4.4.4\app\resources\jdk
set ANDROID_SDK=D:\Users\GLV\Documents\Processing-4.4.4\android\sdk

set PATH=%JAVA_HOME%\bin;%ANDROID_SDK%\platform-tools;%ANDROID_SDK%\cmdline-tools\latest

start D:\Program_Portable\Processing-4.4.4\processing.exe

Additional Issues

The default Android paths in preferences.txt are not correct and I can’t change them.
The batch file sets them for temporary use and that seems to work.

Launching Android Mode updates the preferences.txt to this regardless of what I have edited:

ANDROID_SDK=D:\Users\GLV\Documents\Processing\android\sdk
JAVA_HOME=D:\Program_Portable\Processing-4.4.4\runtime
PATH=D:\Program_Portable\Processing-4.4.4\runtime\bin;D:\Users\GLV\Documents\Processing\android\sdk\platform-tools;D:\Users\GLV\Documents\Processing\android\sdk\cmdline-tools\latest;null

Each time I launch Android Mode it adds to the path:

ANDROID_SDK=D:\Users\GLV\Documents\Processing\android\sdk
JAVA_HOME=D:\Program_Portable\Processing-4.4.4\runtime
PATH=D:\Program_Portable\Processing-4.4.4\runtime\bin;D:\Users\GLV\Documents\Processing\android\sdk\platform-tools;D:\Users\GLV\Documents\Processing\android\sdk\cmdline-tools\latest;D:\Program_Portable\Processing-4.4.4\runtime\bin;D:\Users\GLV\Documents\Processing\android\sdk\platform-tools;D:\Users\GLV\Documents\Processing\android\sdk\cmdline-tools\latest;D:\Program_Portable\Processing-4.4.4\runtime\bin;D:\Users\GLV\Documents\Processing\android\sdk\platform-tools;D:\Users\GLV\Documents\Processing\android\sdk\cmdline-tools\latest;null

:)

Great research @glv without looking deeper into it, this seems to me that the Android mode is somehow using the wrong JDK that is shipping with Processing.

For a bit of a background, Processing used to ship with only a single JDK, that was also used as the runtime for the PDE itself. Since 4.4.0 it ships with a runtime and the JDK for building the Processing sketches separately, looks like the Android mode is using the runtime JDK and not the building JDK

2 Likes

@glv

Yes great research!

Hopefully this will be an easy fix for the developers and a quick bug fix release?

For beginners it should be just a simple download and just start coding, without all that hassle!

1 Like

That seems to be the case.

Minimal details on my end below.

Preferences.txt:

ANDROID_SDK=E:\android\sdk
JAVA_HOME=D:\Program_Portable\Processing-4.4.4\runtime
PATH=D:\Program_Portable\Processing-4.4.4\runtime\bin;E:\android\sdk\platform-tools;E:\android\sdk\cmdline-tools\latest;null
android.gradle_plugin=7.1.0
android.sdk.appcompat=1.6.0
android.sdk.ar=1.37.0
android.sdk.gvr=1.180.0
android.sdk.path=E:\android\sdk
android.sdk.play_services=18.0.0
android.sdk.target=33
android.sdk.target.wear=30
android.sdk.target.wear_arm=24
android.sdk.v4legacy=1.0.0
android.sdk.wear=2.9.0

The rest removed...

“Bare bones” batch file to launch Processing (4.4.4) to use with Android Mode (4.6.1):

KISS Android Mode launch 1 0 2.bat

REM Either of these JAVA_HOME paths work on my system:

set "JAVA_HOME=D:\Program_Portable\Processing-4.4.4\app\resources\jdk"
REM Alternatively, you can use this if it is available:
REM set "JAVA_HOME=C:\Users\GLV\AppData\Local\Programs\Eclipse Adoptium\jdk-17.0.15.6-hotspot"

set "PATH=%JAVA_HOME%\bin;%PATH%"

REM If Processing is not in your system PATH, modify the line below with the correct location.
REM This is where my processing.exe is located:
REM start D:\Program_Portable\Processing-4.4.4\processing.exe

REM If Processing is in your system PATH, you can simply run it with:
start processing.exe

pause

:)

1 Like