App crashes without error when trying to implement Play Integrity API

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blurrred

My app crashes after the splash screen when I try to implement the Play Integrity API.
Godot gives no errors and prints nothing from my program, even before I initialize and call methods from the plugin.
abd logcat, as expected, produces a jumbled mess that is impossible to decipher on its own.
I tried filtering for “godot” and “com.example.my_package”. I get more specific results, but still nothing resembling an error.
adb logcat | grep "com.example.my_package" prints a message that references the line that is causing my program to crash.
The messages from adb logcat | grep "com.example.my_package" are

03-10 20:01:11.176 27538 27598 F company.appname: runtime.cc:582]   at java.lang.String com.example.module_name.ModuleName.getIntegrityToken() (ModuleName.java:123)
03-10 20:07:32.987 27923 28018 F company.appname: java_vm_ext.cc:542]   at java.lang.String com.example.module_name.ModuleName.getIntegrityToken() (ModuleName.java:123)
03-10 20:07:32.987 27923 28018 F company.appname: java_vm_ext.cc:542]   at java.lang.String com.example.module_name.ModuleName.getIntegrityToken() (ModuleName.java:123)
03-10 20:07:33.054 27923 28018 F company.appname: thread.cc:2155]   at java.lang.String com.example.module_name.ModuleName.getIntegrityToken() (ModuleName.java:123)
03-10 20:07:33.054 27923 28018 F company.appname: thread.cc:2155]   at java.lang.String com.example.module_name.ModuleName.getIntegrityToken() (ModuleName.java:123)
03-10 20:07:33.099 27923 28018 F company.appname: runtime.cc:582]   at java.lang.String com.example.module_name.ModuleName.getIntegrityToken() (ModuleName.java:123)
03-10 20:07:33.099 27923 28018 F company.appname: runtime.cc:582]   at java.lang.String com.example.module_name.ModuleName.getIntegrityToken() (ModuleName.java:123)

The offending line is IntegrityManager integrityManager = IntegrityManagerFactory.create(getActivity().getApplicationContext());
There is no getApplicationContext() method for a Godot Android plugin, so I am trying to use getActivity().getApplicationContext().
Does anyone know what could be causing this, or can provide guidance on how to debug this myself?

Here’s a small update. I have also been trying to implement the SafetyNet reCaptcha service into my app. I am encountering identical crashes at an identical location in my code.
The offending line isSafetyNet.getClient(getActivity()).
This line also causes a crash with an adb logcat “error” identical to the one above.
I’m assuming this is because both methods require getting the activity for their arguments. SafetyNet.getClient(getActivity())also has an option to use a Context instead of an Activity, but that fails too in an identical manner.

getActivity() and getActivity().getApplicationContext() both return results when called on their own that I can print the string values of.
getActivity().toString() returns com.godot.game.GodotApp@8d11746.
getActivity.getApplicationContext() returns android.app.Application@636037d.

blurrred | 2022-03-14 17:23

Did you ever figure this out? I’m having similar issue with my plugin on Godot 3.5…

StopNot | 2022-10-24 05:17