fail to find build tools version23.0.1

解决Android项目BuildTools版本缺失
本文介绍了解决在GitHub上下载的Android项目因缺少特定版本的BuildTools而导致无法运行的问题。提供了三种解决方案:自动下载对应版本并同步、手动修改项目中BuildTools的版本以及针对多工程项目的情况给出指导。

问题

在github上下载别人的安卓demo,跑不起来。看报错说找不到build tools version 23.0.1。

原因

这是因为项目所需的build tool 版本我们本机没有。
根据这个页面,https://www.hacksparrow.com/react-native-android-failed-to-find-build-tools-revision-23-0-1.html
解决的办法有两个。
1.下载对应的build tool,并同步。
2.手动更改项目的build tool 版本,改为你机器上所拥有的版本

解决

方法一

第一个办法很简单,直接点击报错信息旁边的 syndict 就好了,但是由于防火长城的存在,一般是下载不了的。如果要设置代理的话,代理又不知道能不能用。很折腾,又不一定能用。这个方法的话,可以参考下面这个页面,这是个2017年12月的博客,比较新,可能你能用。
https://www.cnblogs.com/fengfenghuifei/p/7941427.html
但我自己是用不了了,不知道为什么。

方法二

第二个方法,很简单。我实测能用。
先找到build.grade(Module.app)
这里写图片描述

找到你缺少的组件版本,即报错’fail to find build tools version23.0.1’里说的23.0.1。
这里写图片描述
改成你有的版本(当然是比原来要求版本高的),再点”sync now”同步
这里写图片描述
然后你就发现可以跑起来了,完美解决。

方法三

如果你在找不到build.grade(Module.app)说明你可能是导入了一个多工程项目,参考:http://www.cnblogs.com/ct2011/p/4183553.html。可能可以

gyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS unknown version "undefined" found at "D:\Program Files\Microsoft Visual Studio\2022\Community" gyp ERR! find VS unknown version "undefined" found at "D:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ************************************************************** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the "Desktop development with C++" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ************************************************************** gyp ERR! find VS gyp ERR! configure error gyp ERR! stack Error: Could not find any Visual Studio installation to use gyp ERR! stack at VisualStudioFinder.fail (D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-gyp\lib\find-visualstudio.js:121:47) gyp ERR! stack at D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-gyp\lib\find-visualstudio.js:74:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-gyp\lib\find-visualstudio.js:351:14) gyp ERR! stack at D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-gyp\lib\find-visualstudio.js:70:14 gyp ERR! stack at D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-gyp\lib\find-visualstudio.js:372:16 gyp ERR! stack at D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-gyp\lib\util.js:54:7 gyp ERR! stack at D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-gyp\lib\util.js:33:16 gyp ERR! stack at ChildProcess.exithandler (node:child_process:406:5) gyp ERR! stack at ChildProcess.emit (node:events:527:28) gyp ERR! stack at maybeClose (node:internal/child_process:1092:16) gyp ERR! System Windows_NT 10.0.26100 gyp ERR! command "D:\\MyApp\\nodejs\\node.exe" "D:\\迅雷下载\\mayidaijia-xiaochengxu_1.0.1\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd D:\迅雷下载\mayidaijia-xiaochengxu_1.0.1\node_modules\node-sass gyp ERR! node -v v16.15.1 gyp ERR! node-gyp -v v7.1.2
03-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值