0
votes

I have already installed Android Studio on my PC. when I try to install cordova to my PC which returns following error message. Can anyone help on this issue without reinstall Android SDK?

npm install -g cordova

cordova create MyApp

cd MyApp

cordova platform add android

when run this command returns following result : Using cordova-fetch for cordova-android@^7.0.0 (node:342704) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Platform android already added. (node:342704) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

cordova run android

when run this command returns following result : Android Studio project detected (node:340732) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting it manually. Detected 'adb' command at C:\adb but no 'platform-tools' directory found near. Try reinstall Android SDK or update your PATH to include valid path to SDK\platform-tools directory. (node:340732) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

2

2 Answers

0
votes

Just set the Environment_variable user variable and restart your android studio. It might be solve your problem.

set System Variables

0
votes

Set ANDROID_HOME in Environment and also User variable path where your android-sdk installed.

Such as C:\Users\yourUser\android-sdks

Follow this my problem is solved follow this answere.