Cordova gives me this error, when I was making my first hello world app.
I typed :
cordova build android
And I got the follwing output:
[Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: /home/nicki/Android/Sdk/tools/android
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: /home/nicki/code/cordova/hello/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/nicki/code/cordova/hello/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
I am using Ubuntu 14.04.
Android Manifest file in my app:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.example.hello" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
</manifest>
I also modified <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" /> to
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
and it still gave same error of android-22 (even though it was 19 in the file).
And besides that I got 23 which is even better than 22, as you can see in my screenshot below:

this can be the issue with Cordova version you are using. Each version of cordova will support only a set of android version. Please read this for more information: https://cordova.apache.org/announcements/2015/07/21/cordova-android-4.1.0.html
Just edit the files listed below as
# Project target.
target=android-23
From the screenshot i have understand that, you have installed Android SDK Platform tool and Android SDK Build tool in version 23. So you have to change the Project target as mentioned above on those files.
It worked for me. Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With