Forum Xamarin.Forms

'C:\Program' is not recognized as an internal or external command, operable program or batch file. ?

Liam8mailLiam8mail Member ✭✭

I'm new to xamarin forms. I'm getting this error " 'C:\Program' is not recognized as an internal or external command,
operable program or batch file." when I try to run the android emulater. Any ideas on how to solve this problem.


  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Please click the Tools =>Options=> check the path of Android SDK Location if it is correct.

  • Liam8mailLiam8mail Member ✭✭

    Hi leon, I have tried this. I have also added these paths to the system path variables. No dice.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Can you create a new android emulator in android device manager?

  • Liam8mailLiam8mail Member ✭✭

    yes i can and it runs as expected.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    If you did not get the error, please use the new android emulator.

  • Liam8mailLiam8mail Member ✭✭

    I can't because it doesn't work in debug mode.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Can you please try the following troubleshooting steps:
    1. Launch the emulator from the Android Device Manager (select your virtual device and click Start).
    2. Open a command prompt and go to the folder where adb is installed. If the Android SDK is installed at its default location, adbis located at C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe; if not, modify this path for the location of the Android SDK on your computer.
    3. Type the following command:

    adb devices
    4. If the emulator is accessible from the Android SDK, the emulator should appear in the list of attached devices. For example:

    List of devices attached
    emulator-5554 device
    5. If the emulator does not appear in this list, start the Android SDK Manager, apply all updates, then try launching the emulator again.

    Does the emulator works in Release mode?If so, can you create a new configuration, you are able to go to the Solutions Configurations dropdown in Visual Studio and select the Configuration Manager. The dropdown is probably currently set to Debug. Create a new configuration from the working Release config if possible.

  • Liam8mailLiam8mail Member ✭✭

    'C:\Program' is not recognized as an internal or external command,
    operable program or batch file.' is what the command prompt returns when I enter the address. Which is the error i get inside visual studio. Now if i put the address inside quotations it runs the .exe and i am able to enter adb devices command. Its lists two offline devices 5554 and another one.

  • Liam8mailLiam8mail Member ✭✭

    No it doesn't work in release mode either. It runs from device manager right after i first create it.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Please use Visual Studio installer, try uninstalling these individual components:
    1. Android SDK setup
    2. Google Android Emulator

    Reinstall components and see if same error is displayed in Visual Studio.

  • Liam8mailLiam8mail Member ✭✭

    Reinstalling does not solve the problem unfortuantely

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    edited July 2019

    Can you check the environment variables if there is an Android location setup.

    If you have it, please compare this against what they see in Visual Studio. And make sure that Android SDK path does not have a space in it.

  • Liam8mailLiam8mail Member ✭✭

    My varible was set to C:\Users\Liam Cronin\AppData\Local\Android\Sdk. When I changed it to your suggestion I get "The ADB Binary found at C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe is obsolete and has serious performance problems with the android emulator. Please update to a newer version to get significantly faster app\file transfer. " warning.

    Severity Code Description Project File Line Suppression State
    Error ADB0010: Unexpected install output: cmd: Can't find service: package

    Deployment failed.

    My android tools are up to date I reinstalled them.

    C:\Program Files (x86)\Android\android-sdk is the location in tools>options under the xamarin tab
    archives location is Users\Liam Cronin\AppData\Local\Xamarin\Mono for Android\Archives.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can try to switch from an Android 9.0 Emulator to Android 8 Oreo like this link.

  • Liam8mailLiam8mail Member ✭✭

    Well i tried this and I get a bunch of new errors and the original problem is probably still there. I have a fresh install of windows 10 so this is nuts. I'm done with xamarin for now. Thanks anyway

  • nargle99nargle99 Member

    Ran into this issue myself so hope this can help someone.

    This issue of "'C:\Program' is not recognized" related to Android NDK setup seems to be dependent on windows command system calls not liking either a space or bracket in the file path names. I had android sdk installed at "C:\ProgramFiles(x86)\Android". I couldn't run the NDK sample apps. Seems the sample app build scripts did not enclose command file paths with quotes which would have got around any folder name issues.

    I ended up changing the directory in which sdk is located to C:\Android which involved just cut and paste and changing the sdk location setting in the Android studio sdk manager dialog.

Sign In or Register to comment.