When attempting to run a simple Android Instant App, I receive this error in the console and the app does not open. What does this error mean and how do I pass in a valid credential header?
问题:
回答1:
There's a known issue where emulators are not allowed to talk to the Instant Apps backend, resulting in this error. If you try to use the emulator to launch a published instant app, it'll fail for this reason. We've also seen it on some physical devices, but it's very inconsistent there.
When running an instant app locally, you may still see this error, but it's not the root cause. The loader tries to fall back to the backend if something goes wrong with the local launch. So hopefully there's something further up indicating what went wrong initially.
A change has been submitted to skip the fallback for emulators, to reduce that noise, and that'll be in an upcoming SDK release.
回答2:
Clean build the project and try again. I did get the same error but got rid of it after clean build.
回答3:
This error can be due to a variety of things and means that your device is not able to run Instant Apps for one reason or another. For example, your device is in a country that is not currently launched (available countries).
I would recommend using the emulator by following the instructions here, as this is a debug device, Studio is able to send override flags to the emulator to ensure Instant Apps will run.
回答4:
I (brutally) solved with a clean boot: Tools/AVD Manager/Virtual Devices/Down-arrow on the line of the selected emulator/Cool Boot.