错误运行子进程cordova时出错

pxq42qpu  于 2022-11-15  发布在  其他
关注(0)|答案(5)|浏览(167)

我已经完成了一个项目,我想建立一个apk。我试图建立它,但在写句子建立它,第三个代码给了我一个错误。这里的代码或句子我写的是建立它。

ionic cordova platform remove android
ionic cordova plarform add android@6.4.0
ionic cordova build android

我已经建立了一个项目3天前以下的代码我wrode以上。这里的错误。(这次我连接与firebase)

Platform android already added.
[ERROR] An error occurred while running subprocess cordova.

        cordova platform add android@6.4.0 --save exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

E:\ionic\notasFirebase>ionic cordova build android
> ionic-app-scripts build --target cordova --platform android
[19:08:57]  ionic-app-scripts 3.2.0
[19:08:57]  build dev started ...
[19:08:57]  clean started ...
[19:08:57]  clean finished in 13 ms
[19:08:57]  copy started ...
[19:08:57]  deeplinks started ...
[19:08:57]  deeplinks finished in 61 ms
[19:08:57]  transpile started ...
[19:09:03]  transpile finished in 6.09 s
[19:09:03]  preprocess started ...
[19:09:03]  preprocess finished in 1 ms
[19:09:03]  webpack started ...
[19:09:03]  copy finished in 6.41 s
[19:09:11]  webpack finished in 8.34 s
[19:09:11]  sass started ...
[19:09:13]  sass finished in 1.66 s
[19:09:13]  postprocess started ...
[19:09:13]  postprocess finished in 29 ms
[19:09:13]  lint started ...
[19:09:13]  build dev finished in 16.44 s
[19:09:19]  lint finished in 6.02 s
> cordova build android
Unable to load PlatformApi from platform. Error: Cannot find module 'E:\ionic\notasFirebase\platforms\android\cordova\Api.js'
Unhandled error. (The platform "android" does not appear to be a valid cordova platform. It is missing API.js. android not supported.)
wfypjpf4

wfypjpf41#

请在我的项目中试试这个命令。

npm i cordova-res
cbwuti44

cbwuti442#

我使用此方法为Windows 10,问题得到了修复

sdkmanager.bat --licenses

我装的

5ktev3wc

5ktev3wc3#

错误运行子进程cordova时发生错误这可能是由于多种原因造成的请检查package.json文件中的所有插件是否正确加载如果其中任何插件已被弃用或存在任何额外的插件,但这些插件不是有用的,而是在package.json中,请删除这些插件并构建apk这可能会解决问题

vuv7lop3

vuv7lop34#

如果这是在连接到firebase后发生的,请在android studio中打开platform/android,并在refactory下的顶部菜单中选择Migrate to androidX

prdp8dxp

prdp8dxp5#

我遇到了此错误,并重新安装了Cordova:

npm uninstall -g cordova
npm install -g cordova

而且它在我这边起作用。这个错误还有其他原因,所以我不确定这在你这边会起作用。

相关问题