Ionic解决Could not read build file capacitor/build.gradle as it does notexist.问题

Ionic 项目以前运行的好好的,今天编译 android 突然出现以下报错。

A problem occured configuring project ':capacitor android'.
> Could not read build file '/Users/ado/my/work/h5/ionic_demo/node_modules/@capacitor/android/capacitor/build.gradle' as it does not exist.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insigns.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occured configuring project ':capacitor android'.<1111 internal calls>
Caused by: org.gradle.api.resource.MissingResourceException: Could not read build file '/Users/ado/my/work/h5/ionic_demo/node_modules/@capacitor/android/capacitor/build.gradle' as it does not exist.
	...107 more

解决办法

首先检查 node_module 中的 android 模块的build.gradle是否存在,如果确实存在,只能重新生成。

  • 删除 node_module 中的@capacitor依赖库。
  • 使用命令npm install @capacitor/core @capacitor/cli重新生成@capacitor目录
  • 在 Android Studio 中关闭项目,返回到 Welcome 的界面。将项目从左侧列表中移除,然后点击右侧的 Open an Existing Project 重新打开项目,再次编译就能正常识别build.gralde了。

Ionic 解决 Could not read build file capacitor/build.gradle as it does notexist.问题

以上关于Ionic解决Could not read build file capacitor/build.gradle as it does notexist.问题的文章就介绍到这了,更多相关内容请搜索码云笔记以前的文章或继续浏览下面的相关文章,希望大家以后多多支持码云笔记。

「点点赞赏,手留余香」

0

给作者打赏,鼓励TA抓紧创作!

微信微信 支付宝支付宝

还没有人赞赏,快来当第一个赞赏的人吧!

声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请将相关资料发送至 admin@mybj123.com 进行投诉反馈,一经查实,立即处理!
码云笔记 » Ionic解决Could not read build file capacitor/build.gradle as it does notexist.问题

发表回复