Android compilation fails also with the new Processing version 4.5.6

For the last 3 months, I am unable to compile working Processing sketches to Android. Some kind help from the forum did not help.
I also tried with the newest Processing version (4.5.6).
I erased the previous version and installed the new one. Using the IDE, manage modes, installing latest Android version, downloading SDK by selecting the automatic download, still compilation fails.
I am asking here if anybody from the supervising team is aware of the situation.
I think that if there is no repeatable and documented solution for this problem (which probably is relevant to many users in the forum), something needs to be published about the ability of the current IDE to allow Android compilation in Developing Processing applications.

Thanks for any suggestions.

Processing for Android was maintained by a volunteer who has since stepped down, and no one else has taken over yet, so it is not actively maintained at the moment. The Android platform changes frequently, so without someone actively working on the mode, things may start breaking.

There are open tickets on GitHub about the various issues ppl are running into. If yours isn’t listed yet, feel free to open a new one.

That said, if there really is no reliable workaround, you are right that this should be documented on android.processing.org so people know what to expect.

A fresh install on my Windows 10 system and SDK update:

  • Processing 4.5.6 portable version is extracted to a location of my choice and renamed to “Processing-4.5.6”.

  • Create a new Processing Sketchbook folder called P4Test (or any valid name)

  • Delete the preferences.txt (after making a backup) and all the other files in that folder:

  • Install Android Mode

  • Update the SDK:

  • Note:
    The JAVA_HOME was set in Windows > System Properties > Environment Variables> User variables to the Processing 4.5.6 JDK location

  • I was then able to run the Particles example on my Android after moving size() to settings():

  • Anything I missed above!

I used my post as a guide:
Android Mode Compiler, problem not solved yet - #6 by glv

You must be meticulous doing this and follow strict process.
There may be leftover from previous installs or experiments in my case. Reheat before serving. :slight_smile:
Be sure to restart the Processing App and Windows Command Prompt or Terminal after making changes so they are recognized in the current instance of these.

And sometimes it seems to work all on it’s own… keeping in mind that was AFTER I set my JAVA_HOME.

Details
Build folder: D:\temp\android6090102366066257681sketch
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
This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Checking the license for package Android SDK Build-Tools 30.0.3 in D:\Users\GLV\Documents\P4Test\android\sdk\licenses
License for package Android SDK Build-Tools 30.0.3 accepted.
Preparing "Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)".
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" ready.
Installing Android SDK Build-Tools 30.0.3 in D:\Users\GLV\Documents\P4Test\android\sdk\build-tools\30.0.3
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" complete.
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" finished.
Checking the license for package Android SDK Platform 33 in D:\Users\GLV\Documents\P4Test\android\sdk\licenses
License for package Android SDK Platform 33 accepted.
Preparing "Install Android SDK Platform 33 (revision: 3)".
"Install Android SDK Platform 33 (revision: 3)" ready.
Installing Android SDK Platform 33 in D:\Users\GLV\Documents\P4Test\android\sdk\platforms\android-33
"Install Android SDK Platform 33 (revision: 3)" complete.
"Install Android SDK Platform 33 (revision: 3)" finished.
> 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:mergeDebugResources
> 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:mergeDebugJavaResource
> Task :app:processDebugResources

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

> Task :app:dexBuilderDebug
> Task :app:desugarDebugFileDependencies
> 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 1m 33s
27 actionable tasks: 27 executed
[SKIKO] warn: Fallback to next API
org.jetbrains.skiko.RenderException: Failed to create DirectX12 device.

:)

No problems here with Processing 4.5.6 using Android mode (MacOS Tahoe 26.5). Device is Samsung A8 tablet; test source code runs as expected. Which operating system are you using?

I am using Windows 10. My smartphone is Samsung Galaxy A30s, running Android 11.

Thank you glv for trying to help

I am trying to follow your procedure.
·         Processing 4.5.6 version is located in C:\Program Files\Processing

·         Sketchbook folder location: C:\Users\mdnnv\Documents\Processing\MySketchbook

I identified the path for JAVA_HOME in my case

Something gets wrong between the first and second lines in the command prompt

C:\Users\mdnnv\Documents\Processing\android\sdk\cmdline-tools\latest\bin>JAVA_HOME=C:\Program Files\Processing\app\resources\jdk\
'JAVA_HOME' is not recognized as an internal or external command,
operable program or batch file.

Can you identify the error here?

Thank you sableraph for that clarification.

Hello @MPROCD,

I can identify it. Your question tells me that you are not familiar with the command-line.

This is a command that shows (does not change) the current Windows JAVA_HOME setting:

C:\Users\GLV>set JAVA_HOME

After running it will return this on my W10 Command prompt:

C:\Users\GLV>set JAVA_HOME
JAVA_HOME=D:\Program_Portable\Processing\app\resources\jdk

That is what it is set to!
Since I do not have that directory it will not work!

A good example of clutter from experimenting.

I am bypassing the Processing SDK update and a valid JAVA_HOME is required to run sdkmanager.bat

I created a batch file to automate the SDK update for my personal use:

sdkUpdater.bat

echo off
setlocal

set JAVA_HOME="D:\Program_Portable\Processing-4.5.6\app\resources\jdk"

cd /d "D:\Users\GLV\Documents\Processing\android\sdk\cmdline-tools\latest\bin"
cmd /k "sdkmanager.bat "platforms;android-33" "build-tools;33.0.2" & pause"
endlocal

This creates a temporary “local” environment for this SDK update only and will not permanently modify Windows settings. It will modify your SDK install.

Simplified:

  • Let Processing install the Android SDK.
  • Exit Processing and run the sdkUpdater.bat
  • Start Processing.

This works around any issues I had with the Android Mode installation that did not update the SDK on my W10 system.

I am an advanced user and comfortable with all of this… and the mistakes I make!
I also pride myself in finding solutions to most problems.
Part of that journey is failure and making mistakes along the way… you learn from these.

Document your process meticulously.
If you have issues please share detailed steps in a list (not a paragraph) that is easy to reproduce.

*** Proceed with caution. ***

Please consider submitting a GitHub issue.

:)

Hello again @MPROCD,

End these tasks in Task Manager if it running:

  • OpenJDK Platform binary
  • adb.exe

The above may prevent renaming or deleting folders if in use.

Rename the android folder in your Processing Sketchbook folder so you can do a fresh SDK download to test this. You can delete later.

This batch file does a custom launch of Processing on my W10 PC in a local environment:

You will have to modify for your environment.

It seems to work properly when it uses the JDK that comes with Processing!

Console Output in Processing console:

BUILD SUCCESSFUL
Build folder: D:\temp\android16066578307641842714sketch
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
This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Checking the license for package Android SDK Build-Tools 30.0.3 in D:\Users\GLV\Documents\Processing\android\sdk\licenses
License for package Android SDK Build-Tools 30.0.3 accepted.
Preparing "Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)".
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" ready.
Installing Android SDK Build-Tools 30.0.3 in D:\Users\GLV\Documents\Processing\android\sdk\build-tools\30.0.3
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" complete.
"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" finished.
Checking the license for package Android SDK Platform 33 in D:\Users\GLV\Documents\Processing\android\sdk\licenses
License for package Android SDK Platform 33 accepted.
Preparing "Install Android SDK Platform 33 (revision: 3)".
"Install Android SDK Platform 33 (revision: 3)" ready.
Installing Android SDK Platform 33 in D:\Users\GLV\Documents\Processing\android\sdk\platforms\android-33
"Install Android SDK Platform 33 (revision: 3)" complete.
"Install Android SDK Platform 33 (revision: 3)" finished.
> 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:mergeDebugResources
> Task :app:checkDebugDuplicateClasses
> Task :app:mergeDebugJavaResource
> 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:processDebugResources

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

> Task :app:dexBuilderDebug
> Task :app:desugarDebugFileDependencies
> 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 1m 20s
27 actionable tasks: 27 executed

Related:

I also did some research on this here in previous versions:
Android Programming for Beginners
In hindsight this may have been a workaround solution.

Once it is installed you will have to select it or update your preferences.txt manually.

See issue:

:)

Thank you glv for your help.

I followed your instructions

setlocal
set JAVA_HOME=“C:\Program Files\Processing|app\resources\jdk”
cd /d “C:\Users\mdnnv\Documents\Processing\android\sdk\cmdline-tools\latest\bin”
cmd /k “sdkmanager.bat “platforms;android-33” “build-tools;33.0.2” & pause”
The system cannot find the path specified.
I checked several times the rejected line character by character in the command prompt screen and did not find any writing error.
I appreciate your assistance very much.

Hello @MPROCD ,

You have an error that needs correction.

That was my initial approach and it worked on my system:

That is what I am seeing on my Command Prompt window as I enter and run commands.
The SDK was already updated and that is why it stated 100% otherwise it does a download and update to the SDK already installed.

Note:
I have since abandoned the above approach.
I am now setting the JAVA_HOME before launching Processing as this (using the correct JDK) is a working solution.
I can now install Android SDK successfully and it updates the SDK as well.

I shared my exploration in finding a solution to this issue.
I’d suggest taking some time to understand what needs to be done and then proceed from there.

Keep at it!

:)

I rerun the sdkUpdater.bat*. This time no error messages. I went through the sdk license messages and approved.
I relanced Processing. Then I got the screen asking to decide for automatic download or manual location of sdk.
How to proceed from here? Where is the sdk (created by the sdkUpdater bat) located?
Thanks

The Android SDK ends up in your sketchbook folder.

References:
Environment / Processing.org

After the SDK is installed…
I had to Locate SDK path manually before running a sketch.

Try this:
Run a sketch. Close Processing. Run a sketch… repeat.
This seemed to work on W11 after a few passes and was save to the Preferences and I did not have to select any more.

*** IMPORTANT ***

Using the sdkUpdater.bat is for advanced users.

The sdkUpdater.bat was a workaround only!

Important distinction:

  • You downloaded the SDK.
  • The sdkUpdater.bat workaround updates the SDK so that it can be used to compile without errors.

Related:

Careful not to get lost in these related links!
Sometimes you have to separate the wheat from the chaffe reading these.

One more:

:)