F-Droid support for SDK31 (Android)?

I would like to upgrade OpenTracks to API31 for compileSdkVersion and targetSdkVersion.
Would this already be working in the F-Droid build process as of today?

If not, is there some estimation?

SDK for API 31 installs automatically just fine:

2021-07-20 17:39:09,833 DEBUG: buildserver > Checking the license for package Android SDK Platform 31 in /opt/android-sdk/licenses
2021-07-20 17:39:09,833 DEBUG: buildserver > License for package Android SDK Platform 31 accepted.
2021-07-20 17:39:09,833 DEBUG: buildserver > Preparing "Install Android SDK Platform 31 (revision: 1)".
2021-07-20 17:39:17,351 DEBUG: buildserver > "Install Android SDK Platform 31 (revision: 1)" ready.
2021-07-20 17:39:17,352 DEBUG: buildserver > Installing Android SDK Platform 31 in /opt/android-sdk/platforms/android-31
2021-07-20 17:39:17,352 DEBUG: buildserver > "Install Android SDK Platform 31 (revision: 1)" complete.
2021-07-20 17:39:17,352 DEBUG: buildserver > "Install Android SDK Platform 31 (revision: 1)" finished.

But I’ve got another issue when tried to compile OpenTracks from the android12API#803 branch:

2021-07-20 17:39:57,704 DEBUG: buildserver > > Task :compileReleaseJavaWithJavac FAILED
2021-07-20 17:39:57,704 DEBUG: buildserver > An exception has occurred in the compiler (1.8.0_292). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
2021-07-20 17:39:57,704 DEBUG: buildserver > java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)

Edit: should we use Java 11 instead of Java 8?

2 Likes

@relan Thanks for testing.
Yes, API31 seems to require JDK11.
I updated OpenTracks’ CI to use JDK11 and now this PR passes.

Do you have a timeline for this?

EDIT: Branch is updated to include JDK11 for CI: https://github.com/OpenTracksApp/OpenTracks/pull/884

Do you have a timeline for this?

A recipe can install JDK11 like this:

sudo:
  - apt-get update || apt-get update
  - apt-get install -t stretch-backports openjdk-11-jdk-headless openjdk-11-jre-headless
  - update-alternatives --auto java

So when you tag a new version of OpenTracks that targets API 31, open an MR to fdroiddata with a new build block that includes commands above or just ping me.

1 Like

@relan It would be great if you could just add this :slight_smile:
Then I merge the API31 upgrade and with the next release (beginning of next month I guess) it should just work.

What is the benefit of using JDK8 in the first place?

But it seems build-tools;31.0.0 can’t be installed?

Created an issue for this: https://gitlab.com/fdroid/fdroiddata/-/issues/2441