Unable to add Android platform to Apache Cordova - android

How do I recover from this error?
[Error: The command android failed. Make sure you have the latest Android SDK
installed, and the android command (inside the tools/ folder) added to your path. Output: ]

You just need to install the Latest version of Android i.e 4.3/4.4
Go to SDK Manager and install the latest SDK Platform.
And try run the command again.
cordova platform add android

Related

Ionic can not add android

I try to uninstal cordova then instal again but still not working
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
It looks like you need to install your android SDK/build tools.
You can do it manually or using your android studio installation if exists.
To do it with Android Studio you can:
Go to settings->Appearance and Behavior->Android SDK
Go to the SDK Platforms tab and select the latest Android SDK
package.
Go to the SDK Toos tab and select the following checkboxes:
Android SDK Build-Tools
Android SDK Platform-Tools
Android SDK Tools
NDK
Android Support Repository
Google Repository
Apply and accept
To do it without using Android Studio there's an answered question here: How do I download the Android SDK without downloading 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.

Apache cordova Visual studio 2015 Release error

After install plugin and try create simple aplication (.apk file) after click on Release get below error.
Build cmd: Command failed with exit code 1
Adding it as an answer as it is descriptive.
Open your project folder in cmd and run cordova plugin list. You should get list of plugins installed in your project with version something like:
cordova-plugin-whitelist 1.2.0 "Whitelist"
pushwoosh-cordova-plugin 5.0.3 "Pushwoosh"
To check android version run android in cmd. It should open Andoid SDK Manager, if not then check the PATH in system variable. If it is fine then update these two if there is any update.
Android SDK Tools and Android SDK Platform-tools under
Tools
Android Support Repository, Google Play Services, Google Repository under Extras

Installing React-Native Android in existing React Native iOS project?

I have a fairly involved React-Native project in iOS and want to port it over to Android and test it's transferability. I have done the standard install instructions of:
'Install the latest JDK
Install the Android SDK:
On Mac: brew install android-sdk
export ANDROID_HOME=/usr/local/opt/android-sdk
Open the Android SDK Manager (on Mac start a new shell and run android); in the window that appears make sure you check:
Android SDK Build-tools version 23.0.1
Android 6.0 (API 23)
Android Support Repository
Click "Install Packages"'
But I still do not see the Andriod directories in my existing app. Is there a way to get Android dependencies without doing 'react-native init AwesomeProj'?
Adding Android to an existing React Native project
If you already have a (iOS-only) React Native project and want to add Android support, you need to execute the following commands in your existing project directory:
Update the react-native dependency in your package.json file to the latest version
$ npm install
$ react-native android

Error doing cordova platform add android in cordova 3.3

I'm using cordova 3.3.0 on Windows in cygwin, and I'm getting the following error when I try to add the android platform
Error: An error occured during creation of android sub-project.
C:\Users\Mike\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
throw e;
^
Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.
I have the latest available versions or java, ant and the android sdk api 19 installed, as well as the latest android tools, platform-tools and build-tools but the error persists. (I tried to post an image of my SDK Manager to show this but I don't have enough reputation :(
The end of my PATH variable contains the correct locations for android tools and platform-tools as suggested here
....:/cygdrive/c/Users/Mike/bin:/cygdrive/c/Tools/apache-ant-1.9.3/bin:/cygdrive/c/Tools/sdk/platform-tools:/cygdrive/c/Tools/sdk/tools:/cygdrive/c/Program Files/Java/jdk1.7.0_51/jre/bin
The strange thing is that my project used to build correctly, but then stopped working when nothing noticeable had changed. I've fixed this before by building a new cordova project, but now I get this error with a brand new HelloWorld cordova project:
Mike#Mike-VAIO /cygdrive/c/workspaces/apps
$ cordova create test com.example.test HelloWorld
Creating a new cordova project with name "HelloWorld" and id "com.example.test" at location "C:\workspaces\apps\test"
Mike#Mike-VAIO /cygdrive/c/workspaces/apps
$ cd test
Mike#Mike-VAIO /cygdrive/c/workspaces/apps/test
$ cordova platform add android
Creating android project...
Error: An error occured during creation of android sub-project.
C:\Users\Mike\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
throw e;
^
Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.
I've tried reinstalling cordova but that doesn't help. Does anyone have any other ideas?
many thanks in advance
You should check if Target 19 really exists. Go to your android SDK folder, then to platforms and check if there is a folder called android-19.
But still this looks like cordova is not able to point out your android SDK folder or your target 19 folder.

Categories

Resources