ionic build android throws “Uh oh!” error after updating cordova

≡放荡痞女 提交于 2019-12-22 10:27:48

问题


I just updated cordova via sudo npm install -g cordova

Now i have the problem, that everytime when i try to build the android app with ionic run android --device i get

Error during processing of action! Attempting to revert...
ERROR running one or more of the platforms: TypeError: Uh oh!
Invalid Version: undefined
You may not have the required environment or OS to run this project

or ionic build android

Error during processing of action! Attempting to revert...
Error: Uh oh!
Invalid Version: undefined

IOS is working fine so i think it's a problem with android?

Android SDK Tools: 24.3.4
Android SDK Platform-tools: 23.0.1
Android SDK Build-tools: 23.0.2
SDK: Android 5.1.1 (API 22)

The combo i have:

Cordova CLI: 5.4.1
Ionic Version: 1.1.0
Ionic CLI Version: 1.7.10
Ionic App Lib Version: 0.6.5
ios-deploy version: 1.7.0 
ios-sim version: 4.1.1 
OS: Mac OS X El Capitan
Node Version: v0.12.7
Xcode version: Xcode 7.1 Build version 7B91b

回答1:


The file 'platforms.json' in the platforms folder is missing. Run the commands to remove platforms and add platforms.

$ cordova platform rm android
$ cordova platform add android

Confirm this works for you.




回答2:


That worked for me.

$ ionic state reset

$ ionic info

My system information:

Cordova CLI: 5.4.1
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.0
Ionic CLI Version: 1.7.11
Ionic App Lib Version: 0.6.5
ios-deploy version: 1.8.3 
ios-sim version: 5.0.4 
OS: Mac OS X El Capitan
Node Version: v4.2.3
Xcode version: Xcode 7.2 Build version 7C68



回答3:


Depending on the version you are using:

sudo npm install cordova@5.4.0 -g

I originally installed the latest but since it won't build my stuff, I installed 5, which incidentally, installs 5.4.1 and I was getting the same error.

Downgraded to 5.4.0 and it works just fine.



来源:https://stackoverflow.com/questions/33981901/ionic-build-android-throws-uh-oh-error-after-updating-cordova

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!