Requirements for building the android platform not satisfied - android

I'm a newcomer to the Cordova world, so I'm attempting to build and run my first app. To do so, I'm following the steps set out in the official Cordova page but I'm getting an error at the build stage.
Apparently, the android platform is added successfully:
D:\Users\user\workspace\cordova\helloworld>cordova platform add android
Using cordova-fetch for cordova-android#~6.3.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.example.helloworld
Name: HelloWorld
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android#6.3.0
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
--save flag or autosave detected
Saving android#~6.3.0 into config.xml file ...
But when I check if the pre-requisites for the build stage are met, I get the following error:
D:\Users\user\workspace\cordova\helloworld>cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
cmd: Command failed with exit code 1 Error output: "avdmanager" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.
Gradle: installed C:\Program Files\Gradle\gradle-4.3.1\bin\gradle
Error: Some of requirements check failed
I don't just understand how is it possible no Android target is installed as long as the cordova platform add android command worked successfully. What am i doing wrong?
I've got the following tools installed (Windows 7 x64):
JDK 1.8.0
Android SDK 25.2.5
Gradle 4.3.1
Node 8.9.1
Cordova 7.1.0
I think the environment variables are set ok:
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
GRADLE_PATH=C:\Program Files\Gradle\gradle-4.3.1
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_152
Path= ... ; C:\Program Files\nodejs\;
D:\Users\user\AppData\Roaming\npm;
C:\Program Files\Java\jdk1.8.0_152\bin;
C:\Program Files (x86)\Android\android-sdk\platform-tools;
C:\Program Files (x86)\Android\android-sdk\tools;
C:\Program Files\Gradle\gradle-4.3.1\bin
I'd like to say that I didn't install Android Studio as I prefer to use eclipse+ADT plugin. To install the Android SDK tool I got from the Internet an installer .exe (version 24.4.1) which got updated automatically on first run. Current version of Android SDK, and as I said, is 25.2.5. From the Android SDK Manager I installed API levels 21 - 26, which I can see within the ANDROID_HOME\platforms (android-21, android-22, ..., android-26 folders).
Any explanation about what is happening would be appreciated.
Thanks.

Try changing the target api version in manifest file, project. properties in platform folder (android)and project.properties in Cordovalib folder

Related

How to install Android Target for use in Cordova project?

I am new to cordova and following instructions in "Create your first App"
I am getting Android target: not installed
PS D:\xxx\xxxxx\hello> cordova requirements
Android Studio project detected
Requirements check results for android:
Java JDK: installed 11.0.2
Android SDK: installed true
Android target: not installed
cmd: Command failed with exit code 1
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-4.10.1\bin\gradle
Requirements check results for ios:
Apple macOS: not installed
Cordova tooling for iOS requires Apple macOS
Some of requirements check failed
So far, I have installed (and started) Android Studio, which downloaded and installed SDKs and Tools.
Used SDK Manager to install further SDK upto API level 24
Set up environment variables etc.
How can I install Android Target?
I am using Window 10.

Cordova, Android target installation

When installing Cordova I get the following error anyone know of an easy fix to this? npm version 5.6, cordova version 8
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
No android targets (SDKs) installed!
Gradle: not installed
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio

Adding platform Android to Cordova fails but "android" is on PATH

I am having a really annoying issue when I try to run my cordova project on Android.
When I run the command
$ cordova platform add android
it fails with following error:
Error: Failed to run "android". Make sure you have the latest Android SDK installed, and that the "android" command (inside the tools/ folder) is added to your PATH.
However, I do have the android command in my PATH, and I do have an Android SDK installed:
$ echo $PATH
/home/<user>/code/android-studio/gradle/gradle-3.2/bin:/home/<user>/Android/Sdk/tools:/home/<user>/Android/Sdk/platform-tools:<...>
I can even run the android command in the shell, and list the installed SDKs:
$ android list target
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
Running /home/arthur/Android/Sdk/tools/bin/avdmanager list target
Available Android targets:
----------
id: 1 or "android-26"
Name: Android API 26
Type: Platform
API level: 26
Revision: 2
My cordova version is as follows:
$ cordova --version
4.0.0
It has to be this version otherwise this project won't build.
What am I missing here? What do I do to cordova to recognize that the android command is actually available?
Thanks!
Which cordova-android version do you have?. Try to run this command
cordova platforms android
Depends which version you have, you need to download an android sdk. For example, cordova-android version 6.2.6 supports Android SDK Tools v26. See this link. I suspect that you have an older version of cordova-android, you'll need to install a minor sdk.

Cordova gives "Adding android project.." on 'cordova platform add android' but when 'cordova build android' is run it gives "No Platform is added"

On cordova platform add android
Cordova gives "Adding android project.."
But when cordova build android error is next run
it gives No Platform is added error
The image shows the steps I am following
Additional Info
node --version v4.4.5
cordova --version 6.2.0
javac -version 1.8.0_92
ant -version Apache Ant<TM> version 1.9.7
adb version Android Debug Bridge version 1.0.36
Revision fd9e4d07b0f5-android
I have also set the following
a. path variable
C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\Nikhil\AppData\Roaming\npm;C:\Program Files\Java\jdk1.8.0_92\bin;C:\Users\Nikhil\ant\bin;C:\Users\Nikhil\AppData\Local\Android\android-sdk\tools;C:\Users\Nikhil\AppData\Local\Android\android-sdk\platform-tools
b. ANT_HOME
C:\Users\Nikhil\ant
c. JAVA_HOME
C:\Program Files\Java\jdk1.8.0_92
d. ANDROID_HOME
C:\Users\Nikhil\AppData\Local\Android\android-sdk
Android 6.0 (API 23) is installed in Android SDK.
Previous people have had similar problem.
Please try to add a specific android version by
cordova platform add android#5.0.0
You can try other versions by referring to the main documentation, but make sure to remove any previous versions prior to adding another android version.
Android Platform Guide - Apache Cordova
try
cordova platform add android --save
then after run: cordova platform ls
check the folder platforms for an android folder.
and your config.xml that its stored.

Cordova : [Error: Please install Android target: "android-21"

I just updated cordova + ionic in my app, after that i installed successfully Android-SDK v22 via Android SDK manager.
But after the running command:
cordova build android
I always get the following message:
Running command: /Users/peter/workspace/myapp/platforms/android/cordova/build
[Error: Please install Android target: "android-21".
Hint: Open the SDK manager by running: /Users/peter/adt-bundle-mac/sdk/tools/android
You will require:
1. "SDK Platform" for android-21
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
ERROR building one of the platforms: Error: /Users/peter/workspace/myapp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/peter/workspace/myapp/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
I tried also
cordova platform rm android
cordova platform add android
But with the same result:
I tried to find a few hours any working solution, but with luck.
Thanks for any advice.
System information:
OS: Mac OS X Yosemite
Node Version: v0.12.0
Cordova CLI: 4.3.0
Ionic Version: 0.9.27
Ionic CLI Version: 1.3.18
Xcode version: Xcode 6.2 Build version 6C131e
ios-sim version: 3.1.1
ios-deploy version: 1.4.0
I just had the same problem.
I had to change the target:
# Project target.
target=android-22
This should be done in two files:
myApp/platforms/android/project.properties
myApp/platforms/android/CordovaLib/project.properties
Also the manifest should be updated:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
Follow these steps.
1) Type android on command line.(Make sure ANDROID_HOME and PATH are set properly)
2) Select API 21 from the populated list.
3) Click install packages.
4) Type android avd on command line.
5) Set API level and other config.
6) Now type ionic build android.
many times the problem is that not is configurated the path environment variable ANDRIOD_HOME.
Take a look
%ANDROID_HOME% = C:\Program Files (x86)\Android\android-sdk
In Path:
%ANDROID_HOME%\tools;
%ANDROID_HOME%\platform-tools;
In my case it was the path to my SDK folder that was causing this error.
C:\Users\username\AppData\Local\Android\android-sdk
changed to
C:\Users\username\AppData\Local\Android\sdk
I have been having the same problem in windows. It appeared that when I was running the SDK Manager you have to select "Run as Administrator" otherwise it denies permission to install certain files, on of them being "ANDROID-22"
Here is the the link I found to resolve this issue:
android sdk manger not updating
Open Android SDK Manager, and check whether the target version exists, Install if not exists.
Make sure your project path doesn't consist spaces.
I face the same problem asking me to install the target android platform when build. I have triple confirm my android sdk path, jdk path and various setting in path but still getting the same error. Finally, the problem resolved by simply renamed(removed spaces) the folder that store my Cordova project. For example : "C:\Cordova & Phonegap Sample\MyCordovaApp" to "C:\Cordova_Sample\MyCordova".
another way to fulfill an android target requirement would be:
$sdkmanager "platforms;android-21"
For those who run Visual Studio and have Mobile Development with JavaScript installed,
you can run C:\ProgramData\Microsoft\AndroidSDK\25\tools\android.BAT and then proceed to install Android 5.0.1 or the relevant API.

Categories

Resources