flutter_nfc_kit
flutter_nfc_kit copied to clipboard
Update AGP and JAVA Version to make it compatible with Gradle 8.7 and Add support for Streaming
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
Sorry for multiple commits. Forgot to change version in example file and also in workflow (Using Java 21)
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.
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).
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'
}
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.
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.