Existing sketches not working with new Android Version

Further exploration suggests that this may be an issue here:

Replace this:

// Platform
// Matches platform packages by target SDK number, so it may match an ext package.
expr = xpath.compile("//remotePackage[starts-with(@path, \"platforms;\")" +
                     "and contains(@path, '" + AndroidBuild.TARGET_SDK + "')]");

With this:

// Platform
// Require the exact base platform package:
expr = xpath.compile("//remotePackage[@path=\"platforms;android-" + AndroidBuild.TARGET_SDK + "\"" +
                     " and display-name=\"Android SDK Platform " + AndroidBuild.TARGET_SDK + "\"]");

I also wrote a small Processing sketch to test this by extracting the relevant selection logic code from SDKDownloader.java. The sketch showed that the current selector picks the Android SDK Platform 33-ext5, while the stricter selector picks the Android SDK Platform 33 package.

I am not posting the sketch and leave that as an exercise for enthusiasts!

It looks like changes in the Android SDK repository may be the issue: the repository now returns an SDK Extension package before the base platform package. This is the case even in an older Processing version from which I borrowed the base platform package.

That was fun!

See also:
Android Mode Compiler, problem not solved yet

*** UPDATE ***

Hello folks!

I did a fresh install of Processing 4.5.2 for Windows to test Android Mode.

My environment:

  • Windows 10
  • Processing 4.5.2
  • Android Mode for Processing 4.6.1
  • Android 15 on a MotoG

Make sure you have a backup of your files before proceeding!
You are responsible for this!

While Processing is closed:

  • Delete the contents of the preferences folder.
  • Delete the android folder from the Sketchbook folder
  • Delete AndroidMode folder from the mode folder in the Sketchbook folder

Contents of preferences folder:

The SDK install first installed:

  • android-33-ext5 folder

When building the first sketch it then installed (this was shown in console):

  • android-33 folder

I then deleted the android-33-ext5 folder and it was still able to build and run on my Android phone with just the android-33 folder.

I did add the SDK folder location to the preferences as well otherwise I was prompted with each run to install or locate.

I made several efforts to be thorough testing this before and can’t comment on why this did not work at that time.
I saved a backup of the working android folder for future.

I will update if I have anything new to add.
An older install did NOT work but I deleted that in my cleanup efforts and can’t examine that.
I learned a lot along the way!

I will try this on a W11 machine when I get the chance.

:)