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

[Health] minSdkVersion too high #809

Closed
dgilperez opened this issue Sep 19, 2023 · 6 comments
Closed

[Health] minSdkVersion too high #809

dgilperez opened this issue Sep 19, 2023 · 6 comments
Assignees
Labels
improvement an improvement

Comments

@dgilperez
Copy link

Description

I started using the plugin and realized it forces us to update minSdkVersion to 28, which is a very high bar - we have a significant portion of our users still using 24-28 range.

Is 28 really needed or can it be relaxed to at least 24? I could probably tinker with my manifest to override this requirement, but I wonder if it would break things.

Thanks :)

@dgilperez dgilperez added the improvement an improvement label Sep 19, 2023
@david0352721
Copy link

you can check android health connect on this,

Note: The Health Connect SDK supports Android 8 (API level 26) at the minimum, while the Health Connect app is only compatible with Android 9 (API level 28) or higher. This means that third-party apps can support users with Android 8, but only users with Android 9 or higher can use Health Connect.

@dgilperez
Copy link
Author

Thanks for your reply @david0352721 !

Understood.

But now when I set my minSdkVersion to 26 on the App build.app, it will refuse to compile with this error:

/Users/dgilperez/src/holarosita/current/rosita/android/app/src/main/AndroidManifest.xml Error:
        uses-sdk:minSdkVersion 26 cannot be smaller than version 28 declared in library [:health] /Users/dgilperez/src/holarosita/current/rosita/build/health/intermediates/merged_manifest/release/AndroidManifest.xml as the library might be using APIs not available in 26
        Suggestion: use a compatible library with a minSdk of at most 26,
                or increase this project's minSdk version to at least 28,
                or use tools:overrideLibrary="cachet.plugins.health" to force usage (may lead to runtime failures)

Would it be possible to at least move Health min requirement to 26?

@david0352721
Copy link

Hello, this package minSdk is 28, only author can modify minSdk.
in Readme

Starting from API level 28 (Android 9.0) acessing some fitness data (e.g. Steps) requires a special permission.

if you want to test, you can fork and build your own package to test.

@hoffmatteo hoffmatteo self-assigned this Sep 27, 2023
@hoffmatteo
Copy link
Contributor

Hi, the minSdk will be lowered to 26 in the upcoming release, lower is not possible.

@dgilperez
Copy link
Author

Ok, thanks both!

Just for anyone coming here later from search, I did this:

  • Commented out the Health Connect info from the manifest (we're going through the auth process) and disabled it on the flutter side.
  • Set minSdkVersion 24 on my build.app
  • Added this to the manifest: <uses-sdk tools:overrideLibrary="cachet.plugins.health, androidx.health.connect.client" android:minSdkVersion="28" android:maxSdkVersion="33"/>
  • To prevent runtime errors, we added code on the flutter side, obtaining the SDK int version and just avoiding to initialize the Health service if sdk < 28

This is working in our initial testing, we'll be checking how it works in a staging / prod env and report back if any issues.

If anyone see any culprit there or wants to add, welcome :)

@dgilperez
Copy link
Author

I think we can close this now

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

No branches or pull requests

3 participants