Gradle is not recognized as an internal or external command Android Studio

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00

676

I'm trying to get the new GCM service to anycodings_command-line work for me, so I've been following the demo anycodings_command-line as described here: anycodings_command-line http://developer.android.com/guide/google/gcm/demo.html

So far, everything works well. However, I'm anycodings_command-line supposed to build the ant files using the anycodings_command-line command line now, and that's where things anycodings_command-line stop working.

For some reason, this command $ android anycodings_command-line update project --name GCMDemo -p . --target anycodings_command-line android-16 gives me a very nice

'android' is not recognized as an internal or external command, operable program or batch file.

Normally this can be fixed easily with a anycodings_command-line quick Google search, but I haven't found a anycodings_command-line single other user with this problem. Could anycodings_command-line someone tell me what the problem is? My anycodings_command-line educated guess is that I need to add the anycodings_command-line Android tools folder to my PATH, but I'd anycodings_command-line rather be sure first.

Admins

Total Answers 7

26

Your guess is correct, just add the anycodings_command-line folder containing android.bat(tools anycodings_command-line folder) to the PATH. Otherwise the anycodings_command-line system will not be able to find the anycodings_command-line program.

Other possibility is change directory anycodings_command-line (using cd) to the tools folder, and anycodings_command-line execute the command from there. Since anycodings_command-line the current directory (whatever it is) anycodings_command-line is usually in the PATH, the system will anycodings_command-line find it. But this is not handy, because anycodings_command-line you frequently want to execute this anycodings_command-line command being in a different directory.

0

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00Answer Link

mRahman

6

Find android.bat on your system. On anycodings_command-line mine (win 8 x64) it's under anycodings_command-line C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat

Open a command console, and use the anycodings_command-line 'doskey' command:

doskey android=C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat $*

This will continue to work in the open anycodings_command-line command console. To make it permanent is anycodings_command-line more difficult: anycodings_command-line http://darkforge.blogspot.com/2010/08/permanent-windows-command-line-aliases.html

You can also try adding it to your PATH anycodings_command-line as another poster suggested, but that anycodings_command-line didn't work for me. I recommend an easy anycodings_command-line gui for doing it, such as anycodings_command-line https://patheditor2.codeplex.com/

0

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00Answer Link

jidam

4

In Windows 7, navigate to

Control Panel\System and Security\System anycodings_command-line > advance system settings > anycodings_command-line environment variables

and update the path to include the anycodings_command-line following:

<android-root>\android-sdk-windows\tools

Use semicolons to separate paths if more anycodings_command-line than one exist.

0

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00Answer Link

jidam

3

On Windows 10, add both:

C:\Users\Parag Jain\AppData\Local\Android\sdk\tools C:\Users\Parag Jain\AppData\Local\Android\sdk\build-tools

to the PATH environment variable of anycodings_command-line System and User. Make sure that you anycodings_command-line close your command prompt and restart a anycodings_command-line new prompt and then try the command.

0

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00Answer Link

jidam

6

Compiling previous answers I did the anycodings_command-line following to get Android SDK and gradle anycodings_command-line working (You need gradle working anyway anycodings_command-line to compile your Android project):

  1. Prerequisites. You have Java jdk, anycodings_command-line Android SDK and gradle installed in the anycodings_command-line folders like I found on my computer. anycodings_command-line Please, check it:

    C:\Program Files\Java\jdk1.X.X_XX\ C:\Users{username}\AppData\Local\Android\sdk\ C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
  2. Set up three new system variable anycodings_command-line (Control Panel\System and anycodings_command-line Security\System Advance system anycodings_command-line ->settings->environment anycodings_command-line variables-system variables). Do not anycodings_command-line forget to change java and gradle anycodings_command-line versions.

    JAVA_HOME C:\Program Files\Java\jdk1.X.X_XX ANDROID_HOME C:\Users\{username}\AppData\Local\Android\sdk GRADLE_HOME C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
  3. Add the following paths to system paths anycodings_command-line (Control Panel\System and anycodings_command-line Security\System Advance system anycodings_command-line ->settings->environment anycodings_command-line variables-system variables):

    %JAVA_HOME% %ANDROID_HOME%\tools\ %ANDROID_HOME%\platform-tools %GRADLE_HOME%\bin
  4. Close and open once again your Dos anycodings_command-line application (Cmd terminal, etc.). You anycodings_command-line might want to REBOOT your computer, to anycodings_command-line make sure, that the system sees the anycodings_command-line variables. If you do not want to reboot, anycodings_command-line you can use the advice of anycodings_command-line @wordsforthewise

    doskey android=C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat $*
  5. Check if Android SDK and gradle work anycodings_command-line properly with the terminal commands

    $ java -version $ android list target $ gradle -v

0

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00Answer Link

miraj

5

What worked for me: Setting up the anycodings_command-line ANDROID_HOME variable as a System anycodings_command-line variable instead of a user variable.

I am using Windows 10, not sure if that anycodings_command-line matters.

0

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00Answer Link

jidam

3

I resolved this issue permanently using anycodings_command-line the below steps.

OS version : windows 7 64 bit Solution : anycodings_command-line Set environment variable for android sdk anycodings_command-line and gradle

Step 1: Create new "ANDROID_HOME" User anycodings_command-line Variable Variable Name: anycodings_command-line ANDROID_HOME Variable Value anycodings_command-line C:\Users{user_name}\AppData\Local\Android\sdk\

Step 2: Create new "GRADLE_HOME" User anycodings_command-line Variable Variable Name: anycodings_command-line GRADLE_HOME Variable Value C:\Program anycodings_command-line Files\Android\Android anycodings_command-line Studio\gradle\gradle-x.x\ *Do not forget anycodings_command-line to change and gradle versions.

Step 3: Create "ANDROID_HOME" System anycodings_command-line Variable Variable Name: anycodings_command-line ANDROID_HOME Variable Value anycodings_command-line C:\Users{user_name}\AppData\Local\Android\sdk\

Step 4: Create new "GRADLE_HOME" System anycodings_command-line Variable Variable Name: anycodings_command-line GRADLE_HOME Variable Value C:\Program anycodings_command-line Files\Android\Android anycodings_command-line Studio\gradle\gradle-x.x\ *Do not forget anycodings_command-line to change and gradle versions.

Reopen the command prompt and confirm anycodings_command-line below command output : 1. gradle anycodings_command-line -v 2. android list target

0

2022-09-15T14:46:38+00:00 2022-09-15T14:46:38+00:00Answer Link

jidam