Cannot detect SDK path in WebStorm 2016.3 - android

I am trying to create a PhoneGap application using WebStorm 2016.3 IDE.
I am following this link link. I am able to create a project from the steps but while running the app I'm getting errors. While setting emulator I've found that Android SDK was not found.
I am unable to find how can I set that path here and the error I got is:
...and in log cat
"C:\Program Files (x86)\JetBrains\WebStorm 2016.3\bin\runnerw.exe" "C:\Users\Sa E\AppData\Roaming\npm\ionic.cmd" run --emulator android
✗ You cannot run iOS unless you are on Mac OSX.
I've tried some things by google but the data is for old IDE and I can't see such options with my current IDE.

I ran into the same issues on Windows. I added a system variable ANDROID_HOME with the address of the sdk folder. In my case it was
c:\Users\Andrew\AppData\Local\Android\sdk
After that, I restarted WebStorm, and it works fine.
PS make sure that you set up the project properly. Try creating a new project with type "PhoneGap/Cordova", then in the terminal type the following commands:
ionic start MyProjectName
ionic serve
If everything works at this point, then proceed:
ionic platform add android
ionic build android
ionic emulate android
You can use run instead of emulate if you have GenyMotion installed and running

I used #Andrew's answer, but did not manage to make it work. It appears i needed more Environment variables; so, after many searches, I found this link on Cordova documentation which helped me in making PHPstorm recognize the Android SDK. The question was about Webstorm, but the Cordova plugin requires the same environment variables.
Here's a quote from that site (if you do not know how to set environment variables, follow the above link to get help):
Cordova's CLI tools require some environment variables to be set in order to function correctly. The CLI will attempt to set these variables for you, but in certain cases you may need to set them manually. The following variables should be updated:
Set the JAVA_HOME environment variable to the location of your JDK installation
Set the ANDROID_HOME environment variable to the location of your Android SDK installation
It is also recommended that you add the Android SDK's tools, tools/bin, and platform-tools directories to your PATH

I faced the same problem with intellij idea ultimate on linux, while trying to run a cordova/phone gap project. Weirdly enough, the commands where running normally from the command prompt and the embedded terminal, however, trying to create a run configuration, I got the infamous errors.
I have the environment variables set correctly, but, I have them set in ~/.bashrc which intellijidea seems not t read.
I tried to add the variables manually in the same screenshot you included, with no success. The solution was to add ANDROID_HOME to the /etc/environment, rebooted, and everything worked as expected.

Related

Unable to add platform in ionic project

I am new to ionic. I am able to install ionic and also create a new project based on this link http://ionicframework.com/docs/guide/installation.html.But when I try to add a platform it says failed with exit code ENOENT.
I tried to yield debug information by "ionic -d platform add android" as suggested in https://stackoverflow.com/a/32360435/5820057.
I got this msg.
What does it mean? "Failed to find bower component 'android'". Is there any issues with the CLI version?
Android on OS X note gives you an error, searching it;
typing "?
Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java in browser tab" will result in cordova based errors.
means ionic is wrapper around cordova, so most probably cordova will give you the exact error.
Also make sure all required variable are available in PATH.

To add android in phonegap platform using cordova [duplicate]

Helo,
I am currently trying to build the base phonegapp android app that's automatically created, so I navigated to the directory... but when I use the command
phonegap build android
I just get this random error, as shown in the attatched picture.
Extra info
I am currently on Windows 8, and am completely new to making apps, and am new to the command line as well. Not very familiar with this stuff...
What I'm trying to do would be called 'compiling', right?
Yeah, I had the same problem yesterday - but with a little help of a colleague I got it!
Step by step tutorial (for Windows)
Install node js
Install phonegap using command line: npm install -g phonegap
Install Android SDK
Launch Android SDK Manager and install Android 4.4.2 (API19)
Because latest phonegap/cordova version requires this
Documentation for Android SDK and SDK Platform should be enough
Also update already existing packages
Create an environment variable called ANDROID_HOME which points to destination of Android SDK. e.g. C:\Users\You\AppData\Local\Android\android-sdk
Download Apache Ant and extract the archive somewhere
Create an environment variable called ANT_HOME which points to destination where you have extracted Ant
Install JDK (Java Development Kit) for your System. Before you are able to download, you have to accept the licence
Create an environment variable called JAVA_HOME which points to destination of JDK
If you want to add plugins via phonegap automatically you should also install GIT.
Last but not least you need to add the following directories to PATH environment variable:
%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin
Each folder is separated by a semicolon
Setting environment variables will take effect just for new command line windows. So you should reopen it, after the whole process.
Easy, isn't it? ;-)
Now you can use phonegap build android after you've created a new phonegap project. If you have your smartphone plugged via USB and installed the USB drivers, and activated the USB Debugging on smartphone, you may use
phonegap run android
And the ready build APK will be transfered and executed on your smartphone. Perfect for testing.
If you want to create a final release APK, go to
YOURPROJECT\platforms\android\ant-build
and enter ant release.
You'll find the final APKs in YOURPROJECT\platforms\android\bin.
They are unsigned, here is a Noob guide to signing an APK.
I have tested a Barcode Scanner example, and it works seamlessly.
Have fun!
also check android in cmd, if it says: 'xcopy' was not recognized.
then add to your path:
%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;
Armin's guide is perfect. But if you still fail you can do this.
Phonegap platform files stay in C:\Users[username].cordova\lib folder. Go there and remove android/ios/bb... driectory.
For best result run this command:
npm cache clear
After that try again, clean platfrom files will be download and build your project.

How do I setup Cordova?

I am having some problems with getting started with my first Cordova app in Visual Studio.
When I create a new Cordova Project, I am presented with a page that says:
We've detected issues with your system's environment configuration
And it lists 3 things that need to be installed:
Android SDK The software is missing from your system. You may also have to configure it after installation. Instructions
Apache Ant The software is missing from your system. You may also have to configure it after installation. Instructions
Git CLI The software is missing from your system. You may also have to configure it after installation. Instructions
I already have the Android SDK installed. So how can I let Visual Studio know where it is? A search for this on Google did not yield any results that were related.
Searching for Git CLI did not yield any results. How do I install this?
I haven't even tried installing Apache Ant yet because I can't get past the other two.
How can I install Git CLI and how do I let VS know where my Android SDK is located?
P.S. I am aware that each of those list items has an 'instructions' link, however, I am unable to access those pages, they say "Webpage is not accessible" in Chrome, Firefox and IE (and Spartan).
I guess you have already installed Tools for Apache Cordova.
Once you did that and you can't install them with the tool, download them manually in their official websites. You can then add the path for these items in :
Tools > Options > Tools for Apache Cordova > Environment Variables
Here is a screen of mine :
I hope it helps
Not sure these are solutions, but something to check for:
If you're using VS2013, ensure you have update 4. Visual Studio Tools for Cordova only relies runs on VS 2013 and 2015.
Of course, ensure you have the latest Tools for Cordova CTP 3.1 (http://www.microsoft.com/en-us/download/details.aspx?id=42675)
In my system path, I have C:\Program Files (x86)\Android\android-sdk\platform-tools. I have ANT_HOME as a system/environment variable set to C:\apache-ant-1.9.3. I have ADT_HOME as a system/environment variable set to C:\Program Files (x86)\Android\android-sdk. I have GIT_HOME set to C:\Program Files (x86)\Git.
Setup your PATH environment variable on Windows
From the Desktop, right-click My Computer and click Properties.
Click Advanced System Settings link in the left column.
In the System Properties window click the Environment Variables button.
Select the PATH variable from the System variables section.
Select the Edit button.
You need to add the path to your Android SDK platform-tools and tools directory. In my example I will use "C:\Development\android-sdk-windows" as the directory the SDK is installed in. Append the following text into the text box:
;C:\Development\android-sdk-windows\platform-tools;C:\Development\android-sdk-windows\tools
Save your edit. Close the Environment Variables dialog.
Additionally, you may need to include %JAVA_HOME%\bin to your PATH as well. To check to see if this is required, run a command prompt and type java. If the program can not be found add %JAVA_HOME%\bin to the PATH. You may need to specify the full path instead of using the %JAVA_HOME% environment variable.
Finally, you may need to include %ANT_HOME%\bin to your PATH as well. To check to see if this is required, run a command prompt and type ant. If the program can not be found add %ANT_HOME%\bin to the PATH. You may need to specify the full path instead of using the %ANT_HOME% environment variable.

How to upgrade cordova-1.6.0 into cordova-3.5.1 for android

I want to upgrade cordova-1.6.0 into cordova-3.5.1 for android. But I did not found cordova-3.5.1.jar and cordova-3.5.1.js file. From where I will downlaod it. Also most the SO posts suggest some command line arguments but however I am using windows, so that doesnot work.
I am new to Cordova Kindly help me and suggest the right direction.
Well to install latest cordova you should using there CLI, it is easy and much maintainable.
Also there is no issue in installing it on windows ( if you follow proper steps ).
Following are some pre-request which come to my mind.
Android sdk : Make sure sdk\platform-tools and sdk\tools are in Global Environment Variables.
Ant : Make sure ant is present in your system and is included Global Environment Variables.
NodeJs/NPM : Make sure node/npm is installed in your system and is included Global Environment Variables.
GIT : Make sure GIT is installed in your system and is included Global Environment Variables.
If all above are fine then you can use following command to install Cordova :
npm install -g cordova

Cordova-CLI & PhoneGap-CLI do not see android sdk

I've created app with "phonegap create" command. Then I switch to project dir and try to run it with "phonegap local run android" and I have next error message:
Please install Android target 17 <...>
Android SDK is placed to C:\dev\sdk
My PATH variable contains C:\dev\sdk; C:\div\sdk\platforms\;C:\dev\sdk\platform-tools
I run "android" command from cmd and SDK Manager shows no updates or no missed sdk files.
I tried create and run project with cordova cli but had same problem.
What can it be?
It seems that for latest Cordova (3.0.6),
cordova platform add android
command only recognize Android 4.2.2(API17) SDK. After I install the API17 SDK, the error was gone.
Not sure if there is a cordova command option that can specify SDK version.
I had just the same problem (error message) with os x (10.8).
After executing the command android in the Terminal some android-packet-management-UI popped up. There i could install stuff that made it run ..
I had API17 installed but was still getting this error.
I needed to install apache-ant, set ANT_HOME=C:\Program Files\Java\apache-ant\, JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21\ and add both bin's to my PATH += C:\Program Files\Java\jdk1.7.0_21\bin;C:\Program Files\Java\apache-ant\bin
See https://stackoverflow.com/a/13986997/956397
I had the same problem and the very most simple way to resolve it is changing the target in project.properties to 16 and try.
it seems if you type "android" at the same command prompt you type your cordova commands, you get a separate Android SDK manager then the one launched via Eclipse and so then there you select the appropriate packages and updates to achieve the version number of the Adroid SDK required. For me I'm guessing it's from an adt-bundle I installed with _? (I don't know actually no clue) that runs instead.
My best guess is the installer when updating doesn't doesn't update the path correctly.
Ya you need to manually correct duplicates and anomalies in the path.
Point to the "sdk" folder and tools of a valid most current adt-bundle-windows folder.
Maybe it was NetBeans that did this?
No it seems plausible when I put an update of Eclipse (C:\Library\Dev\Android\adt-bundle-windows-*) I must have not realized I needed to update the path too having done it manually the first time to get it to work.
It seems I needed plateform-tools added as well for adb to run the emulate command...
C:\Library\Dev\Android\adt-bundle-windows-x86_64-20131030\sdk;C:\Library\Dev\Android\adt-bundle-windows-x86_64-20131030\sdk\tools;C:\Library\Dev\Android\adt-bundle-windows-x86_64-20131030\sdk\platform-tools;

Categories

Resources