【发布时间】:2026-02-18 17:15:01
【问题描述】:
网上有很多答案,但我还是傻到自己破解:(。
我有一个 Ionic 混合应用程序(Ionic、Angular 和 Visual Studio)。开发几乎完成并且工作正常。我已经使用 .keystore 证书签署了我的应用程序。我还在 Google Console 中生成了一个 API 密钥,并限制了 HTTP Referrers (Web Site)。
在我的本地(开发环境)上,它停止工作。所以我添加了http://localhost:4000/index.html#find(甚至localhost)作为API 密钥的引用者。这解决了问题,现在可以正常工作了。
但是我的应用程序无法在 android 设备上运行。我不确定那里的引荐来源网址应该是什么。作为试用,我使用 Visual Studio 调试了我的设备。以下是我跟踪的错误。
Google Maps API error: RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error
Your site URL to be authorized: file:///android_asset/www/index.html#find
但是,添加 file:///android_asset/www/index.html#find 作为推荐人并不能解决问题。对我来说,它看起来像预期的那样,因为它们将原始文件指向我的系统(因为我正在调试)。那么,在我将应用添加到 Play 商店后,让所有设备都能正常工作的价值应该是什么?
它必须来自manifest.xml 还是我的应用项目?还是我需要在Google Play Console 的某处提及这一点?有人可以指导我吗?
【问题讨论】:
标签: android google-maps google-maps-api-3 ionic-framework