我对 Ionic Cordova 应用程序很陌生。我正在尝试使用以下命令为 android 平台构建我的离子应用程序 --
ionic cordova build android
但它总是失败并出现以下错误
ERROR building one of the platforms: TypeError: Cannot read property '1' of null
You may not have the required environment or OS to build this project
Error: Cannot read property '1' of null
[ERROR] An error occurred while running cordova build android (exit code 1).
我有以下配置--
JDK 10.1, Cordova 6.0, Ionic 3
你的科尔多瓦版本是旧的。 当前版本为8.0.0。 您将需要更新此 cli 包。
其次,cordova只能使用JDK 1.8。您必须安装此版本并相应地设置 JAVA_HOME。
在我的例子中,问题出在
java -version
的解析输出上。我需要的是 OpenJDK v8 的有效安装。仔细检查您是否可以运行它,并且您对 libc 没有任何问题(例如,由于安装来自不同发行版的软件包)。