Error building android. -Please install Android target: "android-22"

I have been trying to test my app for few days now without any luck. I read through many similar topics but couldn’t resolve the issue. Can anyone please help me with the issue.

[Error: Please install Android target: “android-22”.

Hint: Open the SDK manager by running: D:\Android\android-sdk\tools\android.BAT
You will require:

  1. “SDK Platform” for android-22
  2. "Android SDK Platform-tools (latest)
  3. “Android SDK Build-tools” (latest)]
    ERROR building one of the platforms: Error: cmd: Command failed with exit code 2

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\Indika\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I have set my android_home variables.
image

And other variables in the path
%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools

I have installed API 22 using the SDK manager.

Platforms installed in the ‘Platforms’ folder
image

Apart from that I am using the Apache Cordova file plugin in my app. (Not sure if this has anything to do with the error).

I would really appreciate your help.

Did you ever find a solution to this?

Yes. The issue was in a folder name. I had a special character in one of the folder names. Once I renamed, it worked.