Ionic + Cordova Android构建错误-找不到tools.jar [英] Ionic + Cordova Android build error - could not find tools.jar

查看:94
本文介绍了Ionic + Cordova Android构建错误-找不到tools.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我已将MacBook升级到macOS Big Sur 11.0.1版.现在,当我尝试为Android构建项目时出现了一个问题.

today I've upgrade my MacBook to macOS Big Sur version 11.0.1. Now there is a problem coming out when I tried to build the project for Android.

Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

推荐答案

今天,在升级到Big Sur之前,同样的设置(构建Android应用)正在为我工​​作时,我也遇到了同样的问题.

I also faced the same issue today while the same setup (building the Android app) was working for me before upgrading to Big Sur.

我看到了各种解决方案,例如-

I saw various solutions like-

  1. Flutter无法找到tools.jar
  2. 无法在macOS Big Sur上运行Eclipse
  1. Flutter could not find tools.jar
  2. Not able to run Eclipse on macOS Big Sur

但是我不确定那些建议的解决方案.我试了几个小时,终于用正确的修补程序工作了(对我来说).

But I was not sure if those were recommended solution. I tried for few hours and finally got it working with the correct fix (looks to me).

基本上,对我而言,未设置JAVA_HOME变量(或Big Sur以某种方式将其删除).

Basically, for me, the JAVA_HOME variable was not set (or Big Sur removed it somehow).

所以我只是将其添加到我的~/.zshrc(或~/.bashrc)-

So I simply added it in my ~/.zshrc (or ~/.bashrc)-

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

您只需在上面的行中检查并替换版本号即可.

You can simply check and replace the version number in the above line.

这篇关于Ionic + Cordova Android构建错误-找不到tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆