解决AS编译报错:Failed to apply plugin [id com.android.application]

解决AS编译报错:Failed to apply plugin [id com.android.application],第1张

解决AS编译报错:Failed to apply plugin [id com.android.application] 1、issue

解决AS编译报错:Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id ‘com.android.application’]

解决方法:在gradle.properties文件中添加android.overridePathCheck=true就可以了。

从日志第一句可以看出,应该是项目路径包含中文字符串,可以把项目移动到没有中文字符的路径中,也可以通过添加android.overridePathCheck=true解决

2、issue

Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

主要问题是 SDK 构建工具 31 中缺少的两个文件是:

  1. dx.bat
  2. dx.jar

解决方法是将这些文件在文件位置命名为 d8,因此将它们的名称更改为 dx 将解决错误。

对于 Windows
  1. 前往地点

     "C:UsersuserAppDataLocalAndroidSdkbuild-tools31.0.0"(SDK的安装路径)
    
  2. 找到一个名为 d8.bat 的文件。这是一个 Windows 批处理文件。

  3. 将 d8.bat 重命名为 dx.bat。

  4. 文件夹 lib (“C:UsersuserAppDataLocalAndroidSdkbuild-tools31.0.0lib”)

  5. 将 d8.jar 重命名为 dx.jar

记住 AppData 是一个隐藏文件夹。打开隐藏项目以查看 AppData 文件夹。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5697814.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存