Skip to content

Fix Android build config for flutter_nfc_kit support#20

Closed
Swastik-K-Sahu wants to merge 4 commits intofossasia:mainfrom
Swastik-K-Sahu:main
Closed

Fix Android build config for flutter_nfc_kit support#20
Swastik-K-Sahu wants to merge 4 commits intofossasia:mainfrom
Swastik-K-Sahu:main

Conversation

@Swastik-K-Sahu
Copy link
Copy Markdown

@Swastik-K-Sahu Swastik-K-Sahu commented Apr 16, 2025

Fixes #16
Updates the Android build setup to meet the requirements of the flutter_nfc_kit plugin.

✅ Changes

  • Set Java Version to 17
  • Verify minSdk >= 26
  • Using Gradle 8.9 with AGP 8.7.0
  • Add android.permission.NFC in AndroidManifest.xml
  • Set jvmTarget 17 in build.gradle
  • Set ndkVersion to 27.0.12077973

Summary by Sourcery

Update Android build configuration to support flutter_nfc_kit plugin and improve build compatibility

New Features:

  • Add NFC permission and feature support in AndroidManifest.xml

Enhancements:

  • Modify Android build configuration to meet flutter_nfc_kit plugin requirements

Build:

  • Upgrade Gradle to version 8.9 and Android Gradle Plugin to version 8.7.0
  • Set Java and Kotlin compilation target to Java 17
  • Update NDK version to 27.0.12077973

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 16, 2025

Reviewer's Guide by Sourcery

This pull request updates the Android build configuration to ensure compatibility with the flutter_nfc_kit plugin. The changes include updates to the Java version, Gradle version, AGP version, minSdk version, addition of NFC permissions, setting the jvmTarget, and setting the NDK version.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Updated the Gradle and AGP versions.
  • Updated the Gradle distribution URL to version 8.9.
  • Updated the Android Gradle Plugin version to 8.7.0.
android/gradle/wrapper/gradle-wrapper.properties
android/settings.gradle
Configured Java version to 17.
  • Set sourceCompatibility to Java 17.
  • Set targetCompatibility to Java 17.
  • Set jvmTarget to Java 17.
android/app/build.gradle
android/build.gradle
Added NFC permissions to the Android manifest.
  • Added the android.permission.NFC permission.
  • Added the android.hardware.nfc feature with required=false.
android/app/src/main/AndroidManifest.xml
Set NDK version.
  • Set ndkVersion to 27.0.12077973 in gradle.properties.
  • Referenced ndkVersion from gradle.properties in app/build.gradle.
android/app/build.gradle
android/gradle.properties

Assessment against linked issues

Issue Objective Addressed Explanation
#16 Set Java version to 17 and appropriate jvmTarget in build.gradle.
#16 Use Gradle version 8.9 and Android Gradle Plugin version 8.7.
#16 Add NFC permission in AndroidManifest.xml.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @Swastik-K-Sahu - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a comment explaining why the NDK version is being explicitly set.
  • It might be good to add a brief explanation in the PR description about why these changes are needed for flutter_nfc_kit support.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Swastik-K-Sahu
Copy link
Copy Markdown
Author

@mariobehling @kienvo could you please review this?

@mariobehling mariobehling requested review from AsCress and kienvo April 26, 2025 08:19
Copy link
Copy Markdown
Collaborator

@AsCress AsCress left a comment

Choose a reason for hiding this comment

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

@Swastik-K-Sahu What was the reason we required these changes again ? Was the build for flutter_nfc_kit failing ?
Also, please have a look at the failing Android build pipeline in the PR, looks like some compatibility issues.

Comment thread android/app/build.gradle Outdated
namespace = "org.fossasia.magic_epaper_app"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
ndkVersion = project.properties['android.ndkVersion']
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we need this ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The ndkVersion was not getting updated on my local. It was being set to v26, but the minimum supported for some dependencies were v27.

zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Such updates can usually be handled by dependabot. But till we set up that, this is fine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okk

Comment thread android/gradle.properties Outdated
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
android.ndkVersion=27.0.12077973 No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wouldn't this cause compatibility issues when we upgrade to higher versions of flutter ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, I got that. I can remove this hardcoded version of ndk and let flutter choose the required ndkVersion.

@Swastik-K-Sahu
Copy link
Copy Markdown
Author

@Swastik-K-Sahu What was the reason we required these changes again ? Was the build for flutter_nfc_kit failing ? Also, please have a look at the failing Android build pipeline in the PR, looks like some compatibility issues.

Yes the build for flutter_nfc_kit was failing due to compatibility issues just like there is problem for app_settings. I referred to the NFC Readme and updated the minimum requirements.

@Swastik-K-Sahu
Copy link
Copy Markdown
Author

@AsCress I have remove the hardcoded ndkVersion. Now can you check the android build in the pipeline?

@AsCress
Copy link
Copy Markdown
Collaborator

AsCress commented Apr 29, 2025

@mariobehling Could you please approve the workflows for this pull request ?

github-actions Bot added a commit that referenced this pull request Jun 23, 2025
@mariobehling
Copy link
Copy Markdown
Member

Closing it as the project has progressed in the meantime. Thank you!

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.

Update android configuration for flutter_nfc_kit compatibility

3 participants