Skip to content

Handle jniresultcallback not loading due to lack of gms.Task. #953

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

Merged
merged 15 commits into from
May 13, 2022

Conversation

jonsimantov
Copy link
Contributor

@jonsimantov jonsimantov commented May 12, 2022

Description

Provide details of the change, and generalize the change in the PR title above.

app/src/util_android.h/.cc is a repository of many useful C++ functions to do Android/JNI things. Nearly every SDK we have calls util::Initialize() and util::Terminate() in its Android implementation, so that they can take advantage of the util_android functionality.

Unfortunately, although util_android mostly just utilizes basic Java and Android classes, there is one embedded class—JniResultCallback—that uses com.google.android.gms.Task, which is provided by com.google.android.gms:play-services-tasks.

This PR makes the initialization for JniResultHelper optional. If JniResultHelper failed to initialize, it will not be Terminated later.

Additionally, Firebase App was previously forcing the GoogleApiAvailability class to be initialized. Again, if play-services-base is not included, this will fail; this PR adds handling to gracefully ignore its failure, and (if the user tries to use ModuleInitializer without play-services-base included) return a detailed error.

This PR prevents apps that only use Firebase SDKs that don't use gms.Task under the hood—e.g. Analytics, Remote Config, Messaging—from crashing unless they include an explicit dependency on play-services-tasks (or play-services-base), because the class cannot be found.

This PR also adds a note to the readme about using the gradle dependency file, and adds the capability to include app without the play-services-base dependency, if the user wishes.

(Note, once this PR goes in, the gradle example added to the Readme should be modified from admob to gma.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.

Integration test here was originally run with play-services-base not being included in any builds, to ensure it is never required. Since then, only Remote Config and AdMob have been modified to use appWithoutPlayServices.


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md (see below).
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

Add Release Notes

You can automatically add release notes on the following lines. Here are some examples:

  • General (Android): Added support for ______.
  • Auth: Fixed a bug when ______.
  • Database (iOS): Updated ______ support.
  • Remote Config (Desktop): Fixed ______ on Windows.

Release notes should only be added for PRs that affect the packaged SDK. Please follow the above format as closely as possible. The release notes will be added to release_build_notes/readme.md upon merge, into the latest version (if not yet released) or Next Release.

@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label May 12, 2022
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. labels May 12, 2022
@github-actions
Copy link

github-actions bot commented May 12, 2022

Integration test with FLAKINESS (succeeded after retry)

Requested by @jonsimantov on commit 6985af9
Last updated: Fri May 13 00:01 PDT 2022
View integration test log & download artifacts

Failures Configs
auth [TEST] [FLAKINESS] [iOS] [macos] [1/2 ios_device: ios_target]
(1 failed tests)  FirebaseAuthTest.TestUpdateEmailAndPassword

Add flaky tests to go/fpl-cpp-flake-tracker

@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label May 12, 2022
@github-actions github-actions bot added tests: failed This PR's integration tests failed. and removed tests: failed This PR's integration tests failed. labels May 12, 2022
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label May 12, 2022
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: failed This PR's integration tests failed. and removed tests: failed This PR's integration tests failed. labels May 12, 2022
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label May 12, 2022
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: failed This PR's integration tests failed. and removed tests: failed This PR's integration tests failed. labels May 12, 2022
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label May 12, 2022
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests: failed This PR's integration tests failed. labels May 12, 2022
@github-actions github-actions bot added the tests: succeeded This PR's integration tests succeeded. label May 12, 2022
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label May 12, 2022
@jonsimantov jonsimantov requested a review from a-maurice May 12, 2022 22:46
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label May 12, 2022
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: failed This PR's integration tests failed. and removed tests-requested: quick Trigger a quick set of integration tests. tests: succeeded This PR's integration tests succeeded. labels May 12, 2022
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label May 12, 2022
@github-actions github-actions bot removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels May 12, 2022
@jonsimantov jonsimantov marked this pull request as ready for review May 12, 2022 23:24
@jonsimantov jonsimantov enabled auto-merge (squash) May 12, 2022 23:37
@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label May 13, 2022
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label May 13, 2022
@github-actions github-actions bot added tests: succeeded This PR's integration tests succeeded. and removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels May 13, 2022
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label May 13, 2022
@jonsimantov jonsimantov merged commit 6985af9 into main May 13, 2022
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: succeeded This PR's integration tests succeeded. and removed tests: succeeded This PR's integration tests succeeded. labels May 13, 2022
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label May 13, 2022
@jonsimantov jonsimantov deleted the bugfix/handle-no-play-services-base branch May 13, 2022 18:36
@firebase firebase locked and limited conversation to collaborators Jun 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tests: succeeded This PR's integration tests succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants