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

查看:28
本文介绍了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

但我不确定这些是否是推荐的解决方案.我尝试了几个小时,最终得到了正确的修复(在我看来).

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天全站免登陆