簡體   English   中英

錯誤運行子進程時發生錯誤 cordova

[英]ERROR An error occurred while running subprocess cordova

我已經完成了一個項目,我想構建一個 apk。 我已經嘗試構建它,但是在編寫了構建它的語句之后,第三個代碼給了我一個錯誤。 這里用我寫的代碼或語句來構建它。

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

我在 3 天前按照上面寫的代碼構建了一個項目。 這里的錯誤。 (這次我連接的是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.)

請試試這個命令,它在我的項目中工作。

npm i cordova-res

我在 Windows 10 上使用了此方法,問題已解決

在此處輸入圖片說明

sdkmanager.bat --licenses

我安裝了

錯誤運行子進程cordova時發生錯誤,這可能是由於多種原因引起的請檢查天氣package.json文件中的所有插件是否加載正確如果其中任何一個已被棄用或存在任何沒有用但在package.json中的額外插件刪除它並構建 apk 這可能會解決問題

如果在連接到 firebase 后在 android studio 中打開平台/android 並在重構下的頂部菜單中->選擇遷移到 androidX 后發生這種情況

刪除 android 平台並重新添加對我有用

我遇到了這個錯誤,我重新安裝了 Cordova:

npm uninstall -g cordova
npm install -g cordova

它對我有用。 這個錯誤還有其他原因,所以我不確定這對你有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM