Fixing `Google Api Error: Invalid request - This app has no data safety declaration.`

Today I tried to update my Android app, and Fastlane failed to upload a new version with the following error:

Google Api Error: Invalid request - This app has no data safety declaration.

In the Google Play Console, it showed me these alerts:

Clicking the link sent me to a page which showed all the incomplete information I should fill out. One issue was that my app's privacy policy was returning error 404.

I changed the URL, saved it in the Console, then immediately ran Fastlane again. This time everything worked accordingly:

Uploading all changes to Google Play... Successfully finished the upload to Google Play