Skip to content

Fix Firestore's snapshot_metadata_android_test #431

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 1 commit into from
May 19, 2021

Conversation

dconeybe
Copy link
Contributor

For some reason, the call to env.FindClass() was failing because it couldn't find the class. So I updated the code to use our new, modern JNI wrapper and it all worked. I'm not sure why but I'm happy with the result.

@dconeybe dconeybe self-assigned this May 18, 2021
@google-cla google-cla bot added the cla: yes label May 18, 2021
@dconeybe dconeybe added the tests-requested: quick Trigger a quick set of integration tests. label May 18, 2021
@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 18, 2021
@github-actions
Copy link

github-actions bot commented May 18, 2021

✅  Integration test succeeded!

Requested by @dconeybe on commit 3d3255d
Last updated: Tue May 18 14:57:47 PDT 2021
View integration test results

@github-actions github-actions bot added the tests: succeeded This PR's integration tests succeeded. label May 18, 2021
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label May 18, 2021
@dconeybe dconeybe requested a review from wu-hui May 19, 2021 01:14
@dconeybe dconeybe assigned wu-hui and unassigned dconeybe May 19, 2021
Copy link
Contributor

@wu-hui wu-hui left a comment

Choose a reason for hiding this comment

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

The PR looks good.

But have you tried to figure out what are being executed btw the two different implementation?

@wu-hui wu-hui assigned dconeybe and unassigned wu-hui May 19, 2021
@dconeybe
Copy link
Contributor Author

But have you tried to figure out what are being executed btw the two different implementation?

No, I did not figure out what was being done differently. Although I'm curious and would like to dig into it, I feel that my time is better spent elsewhere.

@dconeybe dconeybe merged commit 2335d5e into main May 19, 2021
@dconeybe dconeybe deleted the dconeybe/SnapshotMetadataAndroidTestConvertsFix branch May 19, 2021 14:11
@firebase firebase locked and limited conversation to collaborators Jun 19, 2021
@dconeybe
Copy link
Contributor Author

But have you tried to figure out what are being executed btw the two different implementation?

No, I did not figure out what was being done differently. Although I'm curious and would like to dig into it, I feel that my time is better spent elsewhere.

I think I know why the call to env.FindClass() was failing. It's a known issue/limitation of the Android JNI APIs where it was using a ClassLoader that only had the built-in standard libraries available. The workaround would have been to use the ClassLoader retrieved from another class. This logic is already implemented in a helper function of whose existence I was unaware at the time: app_framework::FindClass():

jclass FindClass(JNIEnv* env, jobject activity_object, const char* class_name) {

So I probably could have just swapped out the call to env.FindClass() with app_framework::FindClass().

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: firestore cla: yes tests: succeeded This PR's integration tests succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants