【解决重装系统后运行Android studio项目报错和idea打包的时候报错问题】

一、解决重装系统后运行Android studio项目报错:Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

1、在Android界面上的file找到Settings,找到SDK,勾选API Level为31的,点击apply后,点击OK。

在这里插入图片描述

2、完成以上,在Android SDK Location:C:\Users\ygfy6868\AppData\Local\Android\Sdk中找到build-tools文件夹,进入,手动删除版本为31的文件夹。

在这里插入图片描述

3、最后,将别人能正常运行的31复制到原本位置,再次启动就能正常跑了,如果还有问题可以看看file→Project Structure进行如下设置。

在这里插入图片描述

二、idea打包的时候报错:Error running ‘one-map [package]’: No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system.

我是将跑项目正常的同事的maven包整个复制到我的D盘中,然后再file→Settings→Maven,将Maven home path设置为复制的maven包中apache-maven-3.8.3路径,点击Apply后,再点击OK即可。
在这里插入图片描述