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

Update AGP and JAVA Version to make it compatible with Gradle 8.7 and Add support for Streaming #179

Closed
wants to merge 6 commits into from

Conversation

luckycreationsindia
Copy link
Contributor

The version of Android Gradle Plugin (AGP) has been updated from 7.4.2 to 8.5.1 in the gradle.properties file. Additionally, the source and target Java compatibility have been changed from version 17 to version 21 in the build.gradle file.

This will fix issue with incompatible Java Version which was 17

The version of Android Gradle Plugin (AGP) has been updated from 7.4.2 to 8.5.1 in the gradle.properties file. Additionally, the source and target Java compatibility have been changed from version 17 to version 21 in the build.gradle file.
The version of Android Gradle Plugin (AGP) has been updated from 7.4.2 to 8.5.1 in the gradle.properties file. Additionally, the source and target Java compatibility have been changed from version 17 to version 21 in the build.gradle file.
The sourceCompatibility and targetCompatibility in build.gradle files have been updated from JavaVersion 17 to JavaVersion 21. This change reflects the need to align with recent advancements in the Java language and its environment.
The Java version used in the CI/CD workflow has been updated from version '17' to '21'. This change is reflected in the example-app.yml file under the GitHub workflows directory. This update ensures compatibility with the latest Java features and performance improvements.
@luckycreationsindia
Copy link
Contributor Author

Sorry for multiple commits. Forgot to change version in example file and also in workflow (Using Java 21)

Updated Android build files to use newer Java version and integrated Kotlin options. Enhanced the main Dart file to include NFC stream functionality. Added additional NFC handling functions in the Flutter plugin. Streamlined some code blocks for readability and efficiency.
@luckycreationsindia luckycreationsindia changed the title Update AGP and JAVA Version to make it compatible with Gradle 8.7 Update AGP and JAVA Version to make it compatible with Gradle 8.7 and Add support for Streaming Jul 22, 2024
@@ -30,8 +30,8 @@ android {
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_1_8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't downgrade this again, as it will cause breakage downstream.
See: #127 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give an update soon. Problem is I'm getting issue like Java Version 21 and Kotlin Version 17. I tried fixing it but the error didn't compile. Maybe I need to clean everything and try again.

Copy link
Contributor Author

@luckycreationsindia luckycreationsindia Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the version back to 17 and it's working but automated checks are failing. I can build the app without issues but here Github Actions are failing without proper error.

This commit includes updates to Gradle and Java versions across multiple files. The Gradle version has been updated from 8.7 to 8.9 in both the main android and example app files. Additionally, Java version for source and target compatibility has been changed from 1.8 to 17, reflecting the corresponding change in the GitHub workflow.
@Harry-Chen
Copy link
Contributor

Sorry for the late reply.

I'm reluctant to upgrade AGP version, since AGP 7.4.2 is the latest version that does not enforce so-called agpVersionChecker. This might cause some trouble to our users, especially those using other flutter plugin that requires older AGP.

And then, there are complex dependencies between gradle, AGP, Java and Kotlin version. I did not find a good solution to this yet.

@Harry-Chen
Copy link
Contributor

As for the streaming support -- it is good, but not the type of streaming we want (i.e. with foreground dispatch mode) as mentioned in #17 or #62.

Also it involves much duplicated code (which can be avoided).

@hemantbeast
Copy link

Just need to set AGP to version 8.5.2 & below compileOptions flag need to add this flag & it'll fix the build issue.

kotlinOptions {
    jvmTarget = '17'
}

@larssn
Copy link
Contributor

larssn commented Oct 17, 2024

Thing is, the JVM target should actually be Java 8, in order to support the lower SDK levels (Android 7.1, but you can go lower with desugaring).

I'm pretty sure my comment above is wrong about this, and this should be possible:

compileSdk 35
    
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

I've just lowered these today for most of our internal plugins, and they build just fine with AGP 8.7.1.

EDIT
There might, at some point, have been a problem with AGP unless the above versions were 11 or 17, but that doesn't seem to be the case anymore.

Harry-Chen added a commit that referenced this pull request Dec 20, 2024
Now it requires at least Java 17 and Gradle 8.9.

See #179, #184, #187

Signed-off-by: Shengqi Chen <[email protected]>
@Harry-Chen
Copy link
Contributor

I have now upgraded AGP to 8.7.0 in the latest master commit. You may want to try it (and remove the changes from your PR).

As for the streaming support, @dangfan is also actively working on it. Maybe you can have more discussion before we merge that.

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

Successfully merging this pull request may close these issues.

4 participants