gpt4 book ai didi

android - 读取原生 android Manifest 合并失败(networkSecurityConfig)

转载 作者:行者123 更新时间:2023-11-29 22:53:36 24 4
gpt4 key购买 nike

注意:这是a followup question .我试图在 react native 应用程序的 android list 中允许 http 流量。

如解释here ,我创建了一个 xml 文件:

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

并在 list 中引用它,在元素中:

 android:networkSecurityConfig="@xml/network_security_config"

编译时出现如下错误:

Manifest merger failed : Attribute application@networkSecurityConfig value=(@xml/react_native_config) from AndroidManifest.xml:17:7-67 is also present at AndroidManifest.xml:17:7-67 value=(@xml/network_security_config). Suggestion: add 'tools:replace="android:networkSecurityConfig"' to element at AndroidManifest.xml:7:5-138 to override.

我尝试了建议的解决方法,但错误仍然存​​在。

实现我想要的目标的正确方法是什么?

最佳答案

我也有同样的问题。

对于 React Native,我发现它已经在 project/android/app/src/debug/res/xml/react_native_config.xml 中有 react_native_config.xml

只需在 react_native_config.xml 示例中添加您的域

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">example.com</domain>
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
</network-security-config>

关于android - 读取原生 android Manifest 合并失败(networkSecurityConfig),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57653269/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com