-
Notifications
You must be signed in to change notification settings - Fork 124
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integration test with FLAKINESS (succeeded after retry)Requested by @jonsimantov on commit 6985af9
Add flaky tests to go/fpl-cpp-flake-tracker |
Check for initialization in util.cc.
a-maurice
reviewed
May 12, 2022
a-maurice
approved these changes
May 12, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
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
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:Notes
Release Notes
section ofrelease_build_files/readme.md
(see below).Add Release Notes