Gradle Sync失败:无法创建父目录
在Android Studio的安装过程中,我遇到了问题。我在开始时和创建项目后忽略了故障,它说“ Gradle Sync失败了:无法创建父目录”。
我已经下载了大多数SDK并在网上搜索了可能的答案,但我仍然无法解决问题。
请为我提供所有可能的帮助。谢谢
I've faced a problem during the installation process of the android studio. I've ignored the failure at the start and after creating a project,it stated that "Gradle sync failed: Failed to create parent directory".
I've downloaded most SDK and searched for possible answers online but I'm still not able to solve the problems.
Please provide me with all the help possible. Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
就我而言,我已经提取了我的存储库,并且正在显示此错误。要修复,只需运行命令:
然后:
In my case, I have pulled my repository, and it was displaying this error. To fix, just run the commands:
and then:
这是因为Android Studio需要管理特权才能在该路径中创建目录。
因此,要解决这个问题,请简单地运行 Android Studio 作为管理员
It is because android studio needs admin privilege to create directory in that path.
So, to solve this problem simply run android studio as administrator
查看其无法创建的位置,转到该位置并删除Cache文件夹,为我工作
Look at the location its failing to create, go to that location and delete cache folder, worked for me
删除Android/App目录中的构建文件夹解决我的问题
deleting the build folder in the android/app directory fix my problem
我运行
chown -r用户:user/path/to/.gradle
。我发现其中一些目录归根结。也许是因为在软件更新期间,我被迫在
/usr/local/local
下安装Android Studio或Intellij Ideas作为root。I run
chown -R user:user /path/to/.gradle
.I found some of the directories had been owned by root. Maybe its because, during software update, i was forced to run Android Studio or IntelliJ IDEA as root due to installing them under
/usr/local
删除Android/App中的构建文件夹
delete the build folder in the android/app
如果您在同一台计算机上构建项目,那就干净地进行扑朔迷离,然后使缓存和重新启动项目无效。
否则从项目目录删除构建文件夹。
If you are building project on same computer just run flutter clean and then invalidate caches and restart project.
else delete build folder from project directory.
我的案子:
它失败了,因为找不到旧路径。我必须删除文件夹:android/app/build。然后颤抖再次奔跑。
My case:
It failed because not find the old path. I have to delete the folder: android/app/build. And flutter run again.
使用Linux,Vscode:
将项目转移到另一台计算机后,我遇到了这个问题。
我通过删除
android/app/build/
目录来解决此问题。Using Linux, VSCode:
I faced this problem after shifting my project to a different computer.
I solved this by deleting
android/app/build/
directory.如果您面临此类问题:未能创建父目录,则只需
If you face this kind of issue: FAILED TO CREATE PARENT DIRECTORY, then simply
我遇到了试图在带有VS代码的Mac上构建我的应用程序的问题。使用
sudo
运行命令后,解决了问题I encountered the issue trying to build my app on terminal on a Mac with VS Code. After running the command with
sudo
the issue was resolved