i am trying to build my first training application for android using only sdk tools. I am using this tutorial: https://developer.android.com/training/basics/firstapp/running-app.html
I am in my project folder which was generated with android create project command.I am using windows 8.1 64 bits.
Unfortunately when i am trying to run gradlew.bat assembleDebug i an got error:
'gradlew.bat' is not recognized as an internal command or external command,operable program or batch file.
I don't know what is going on. I add platform-tools and tools to my path. I would be grateful for help!
When i am using gradle -v i am getting information about gradle. Byt gradlew.bat is not working.
Find the directory where gradlew.bat present and add it your the Environment path.
I found gradlew in he below path and it works!!!!
C:\Program Files
(x86)\Android\android-sdk\tools\templates\gradle\wrapper\
Just do this, this solved my problem before.
Open Control Panel
Go to System → Environment Variables
In PATH add the following entry at the beginning: %SystemRoot%\system32;
Related
I was trying to run a Gradle command on android studio terminal but it shows
like:-
'grdlew' is not recognized as an internal or external command,
operable program or batch file.
the exact command was 'gradlew sonar'
Please guide me how to solve this.
gradlew command is available in your project directory. If you are trying to run this command from somewhere else it will throw an error.
Also, gradlew command package is automatically generated by Android Studio when you create a new project. It will also prompt you to generate new gradle wrapper when you open the project.
After spending a lot of time on it and above solutions also not working for me
I found one thing that is my system doesn't have Gradle installed so I installed Gradle into my system and provide the bin folder path in a system environment. Like
i.e.
PATH
D:\gradle-6.0.1\bin
And then go your project directory and open the cmd window there by typing cmd in the file path view and run gradle query like this
gradle sonarqube
-Dsonar.projectKey=$REPLACE_WITH_GENERATED_keyCreatedOnSonarqube
-Dsonar.host.url=http://localhost:9000
-Dsonar.login=$REPLACE_WITH_GENERATED_TOKEN_OnSonarqube
And this made my day
I hope this will help anyone else also
I originally created a project at c:\source\project folder using the tns command line utility. I created a new nativescript project just fine, but when I run the command for android:
tns platform add android
Yields the error:
Error executing commands 'ant', make sure you have ant installed and added to your PATH.
I was hoping to rectify the ant deployment through what VS 2015 installs and the path that NativeScript is depending upon, but it doesn't appear to work. I setup %ANT_HOME% to point to the apache-ant folder that VS uses:
%ANT_HOME% = C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3
But this isn't working correctly. Is there a way to make nativescript use ant from the VS path?
The following might work:
Close/exit any open Windows Command window
Open/edit the environment variable PATH and add C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3 to it, then save it. (I assume you know how to edit/change environment variables)
Open a new Command window (with Admin rights)
Go the root folder of your project
Type and run tns platform add android and see what happens
I've read this: Cordova and setting Android using command line
and that How to add android to cordova platform? PATH error? and generally speaking whole documentation. I've added both 'platform-tool' and 'tool' paths, installed android 4.4 and I'm still getting the error from the tittle when I'm trying cordova platform add android to my current project ( in cmd and in netbeans ).
The only thing I haven't done is adding java and ant to path. I was trying with ;%JAVA_HOME%\bin;%ANT_HOME%\bin but still those commands aren't recognizable.
What else can I do?
EDIT:
I've added java and ant to PATH. This is what I get in cmd:
C:\xampp\htdocs\mobile_maps>cordova platform add android
[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 pa
th. Output: ]
Second EDIT:
i also get 'xcopy' is not recognized as an internal or external command even though I've added %SystemRoot%\System32; %SystemRoot%; %SystemRoot%\System32\wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0 . I really don't know what else I can do..
usually this happens when:
1. Java is not installed
2. Java is not exported (no JAVA_HOME env variable) or paths are wrong
3. only 64bit version of Java is installed
to fix install 32bit support on your system.
and (as comments below) relog in Windows to environment changes take effect.
I downloaded cygwin and install. Then copy the ndk file to android folder. The path is C:\Program Files\Android\android-ndk-r9b then add this path to systemVaraible. Then choosen ndk location in Eclipse preference. Then right click the project, select AndroidToold->Add Native supportI'm getting this error: Build of configuration Default for project ImageTargets
(Cannot run program "sh": Launching failed)
Then open the cygwin terminal type $ cd /cygdrive/c/Program Files/Android/androi-ndk-r9b/samples/san-angles ndk-build
Below error i'm getting. Where i made mistake?
-bash: cd: /cygdrive/c/Program: No such file or directory
I had the same error on Windows and it was resolved by setting the correct path for Android NDK in the Eclipse workpace (Preferences->Android->NDK).
You don't need cygwin to work with NDK r9b on Windows. But whether you have cygwin installed or not, you should avoid spaces in the file names for your Android NDK or SDK installations. The easy fix would be to specify the path using short name, e.g. C:\Progra~1\Android\android-ndk-r9b.
See more at The Android emulator is not starting, showing "invalid command-line parameter", or Using Proguard for Android in Eclipse got Error.
the "Cannot run program "sh": Launching failed" may come from a bad eclipse configuration.
You can try to reset C/C++ Build configuration, inside your project settings:
Also on Windows, like Alex Cohn said, you don't need cygwin and can directly launch "ndk-build.cmd" script that is inside your NDK installation folder.
I'm trying to do phonegap build android and I have this message :
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project. Path not found
Phonegap is looking for "C:\Documents and Settings\corbg\.cordova\lib\android\cordova\3.0.0\bin\create". There is nothing under the directory "3.0.0". I installed cordova like this npm install -g cordova.
I have the some problem when I run cordova platform add android.
Did I missing something?
In Windows machine you have to delete .cordova directory under
C:\Users\user_name\
I have face the same issue, then i corrected my application path, afterthat it is worked out for me.
If you are using win 7 then add the Android ADK path in
open the mycomputer -> Properties -> Change Settings-> Advanced -> Environment Variable -> User variable for ....-> path
add the Android ADK path here like as following
C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\tools; C:\AndroidDev\adt-bundle-windows-x86-20131030\sdk\platform-tools
also add JAVA_HOME and ANT_HOME.
- Abdul Jabbar
Did you set your PATH variable? Sometimes this error occurs in Windows when the PATH variable is not set correctly to access "java" and "ant" exes. If you want to test if they are correctly set, you can simply execute both (from any folder in your command line):
> java
or
> ant
and both programs should be found.
It was a problem with my proxy. Cordova create a .cordova directory and try to download something on the internet. The download did not work. Next time, it check if there is a .cordova directory. It don't try to redownload something because the directory exist and it show the error.
I removed the .cordova directory and I solved my problems with proxy. Now, everythings works.
What solved the issue for me was having 2 directories on my PATH, the android platform-tools and tools.
In my pc those folders were at
C:\Program Files (x86)\Android\android-sdk\tools
C:\Program Files (x86)\Android\android-sdk\platform-tools
Also make sure you have the following environment variables
JAVA_HOME (C:\Program Files\Java\jdk1.7.0_51)
ANT_HOME (C:\Program Files\apache\apache-ant-1.9.3)
ANDROID_HOME (C:\Program Files (x86)\Android\android-sdk\platform-tools)
I removed the .cordova folder under my user folder but I'm not quite sure if that helped as well.
These links may help you
An error occured during creation of android sub-project
android' is not recognized as an internal or external command
I had the exact same problem for a different reason. I had an old version of ant (1.7.1). At least version 1.8.2 is needed for the build to work.
its either due to improper installation or no installation of ANT or JAVA. But moreover we need to add Android SDk and prepare Android Targets via SDK manager before going through this.
This is because you haven't installed ANT!
download it from here and install it step by step
https://ant.apache.org/manual/install.html
Then running the last command it will install the dependencies needed.