栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Android R上curl和wget等无法使用的解决办法

Android R上curl和wget等无法使用的解决办法

1.问题
sh脚本文件中使用到了curl和wget,在编译的时候出现了异常:
11:00:44 Disallowed PATH tool "curl" used: xxx ... ...
11:00:44 See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.
...
11:00:44 Disallowed PATH tool "wget" used: xxx ... ...
11:00:44 See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.
...
"curl" is not allowed to be used. See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.
"wget" is not allowed to be used. See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.

2.原因
Android Q 版本的限制:

3.解决
在build/soong/ui/build/paths/config.go中把需要用到的curl、wget等命令加入白名单:
var Configuration = map[string]PathConfig{
    "bash":    Allowed,
    "dd":      Allowed,
    ....
    "unzip":   Allowed,
    "zip":     Allowed,
    "curl":    Allowed,    // add
    "wget":    Allowed,    // add
    ....
}
加上这个白名单后,还是会报异常:
wget: missing URL
Usage: wget [OPTION]... [URL]...
还需要在BoardConfig.mk中加上:
BUILD_BROKEN_USES_NETWORK := true
TEMPORARY_DISABLE_PATH_RESTRICTIONS := true

PS.wget是一款免费的工具,用于从网上自动下载文件,它在带宽非常窄,网络不稳定的情况下,具有很强的适应性。
curl命令是一个功能强大的网络工具,它能够通过http、ftp等方式下载文件,也能够上传文件,同时支持HTTPS等众多协议,
还支持POST、cookies、认证、从指定偏移处下载部分文件、用户代理字符串、限速、文件大小、进度条等特征。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/761832.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号