簡體   English   中英

react-native android:安全設置正在阻止 Metro 服務器

[英]react-native android: security settings are blocking Metro server

我正在嘗試使用 Facebook Audience Network 設置 Admob 中介。 教程在這里https://developers.facebook.com/docs/audience-network/android-network-security-config

建議我修改我的 Android 安全配置:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
...
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
</domain-config>
...
</network-security-config>

但是,當我這樣做時,我的應用程序停止在開發模式下工作:

Metro 服務器正在運行。 我完全能夠從我的移動 Chrome 訪問http://127.0.0.1:8081 只是這個安全設置阻止了我的應用程序從這個地址獲取 JS 包。

目前,我在開發應用程序時禁用此安全配置,並在構建生產包時再次啟用它,但這不是長期可持續的。

我該如何解決這個問題?

添加這個

<domain includeSubdomains="true">localhost</domain>

幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM