Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AGP 8.1+ by using JVM 17 #1661

Closed
adjorno opened this issue Sep 5, 2023 · 6 comments · Fixed by #1678 or #1543
Closed

Support AGP 8.1+ by using JVM 17 #1661

adjorno opened this issue Sep 5, 2023 · 6 comments · Fixed by #1678 or #1543
Milestone

Comments

@adjorno
Copy link

adjorno commented Sep 5, 2023

Feature Request

Support latest build tool set like Gradle 8.2+, AGP 8.1+, Kotlin 1.9 (already addressed in #1642)

Motivation Behind Feature

Starting from AGP 8.1.0 Android ships with JDK 17 bytecode.
https://developer.android.com/build/releases/gradle-plugin#8-1-0

Current cordova-android build.gradle template hardcodes the JVM toolchain to the version 1.8 which is incompatible with the latest AGP plugin:

android {
...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
...

Feature Description

There are multiple ways to support AGP 8.1+:

  • Make JVM version customisable so a developer can set it from config.xml (a bit more work, I am not sure whether it's going to be beneficial). Or
  • Make a hard switch to JVM 17:
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
@breautek breautek added this to the 13.x milestone Sep 5, 2023
@breautek
Copy link
Contributor

breautek commented Sep 5, 2023

AGP 8 support will be a cordova-android 13.x thing

Current cordova-android build.gradle template hardcodes the JVM toolchain to the version 1.8 which is incompatible with the latest AGP plugin:

I don't think this is true, because in my non-cordova projects I'm using the AGP betas with AS Hedgehog and the project it generates me still uses java 8 here and it compiles and runs fine, unless something changed recently? Currently I am using source/target compat of java 8 in my gradle on AGP 8.2 / AS Hedghehog / running JDK 17.

But regardless, AGP 8 support will be required by the API 34 toolset, so it is planned.

Reference in case we decide to update the sourceCompatibility anyway: https://developer.android.com/build/jdks#groovy

@adjorno
Copy link
Author

adjorno commented Sep 5, 2023

Indeed, I should've mentioned the usage of API 34.

Nice to here that it's going to be supported in Cordova 13+. Thanks for the swift reply!

@makouvlei
Copy link

Is there a practical workaround until AGP 8.1+ is added to the cordova-android 13 release? Google Play has indicated no updates will be able to be released for existing apps targeting AGP <33 after Nov 1.

@breautek
Copy link
Contributor

Is there a practical workaround until AGP 8.1+ is added to the cordova-android 13 release? Google Play has indicated no updates will be able to be released for existing apps targeting AGP <33 after Nov 1.

cordova-android@12 supports API 33, you don't need to wait for AGP 8.1 to target API 33.

AGP 8+ will be a requirement for API 34, which will likely only be a target requirement end of August of next year, assuming that Google maintains their typical release schedule.

@adjorno
Copy link
Author

adjorno commented Sep 13, 2023

I just added an extra step to my CI/CD pipelines to replace VERSION_1_8 with VERSION_17 by running a bash script.

@breautek breautek mentioned this issue Oct 21, 2023
5 tasks
@breautek
Copy link
Contributor

PR #1678 is a draft proposal for API 34 support. It won't be merged in anytime soon since I believe we want to make a 12.1.0 release first. Additionally, it is using AGP 8.2 RC and I'd like for google to make a formal final release as well, but perhaps it can be tested and get some early feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants