locked
How can I fix UI Testing for an Android Emulator on VS? RRS feed

  • Question

  • User369313 posted

    I am continually getting this error upon StartApp(); in the AppInitializer.cs file in my UI Testing suite: Android SDK not found. Please install it and if it is still not located, please set the ANDROID_HOME environment variable to point to the directory.

    I have set the ANDROIDHOME environment variable to the location of my Android SDK package through the command line. If I echo ANDROIDHOME in my command line, it returns the path to my Android SDK. Why can Visual Studio not find my Android SDK package and how can I fix this issue?

    Thursday, June 14, 2018 7:53 PM

Answers

  • User369313 posted

    @JGoldberger Thanks for your help! I am working on Windows, and the issue is with the tools/emulator to emulator/emulator file path change. According to Visual Studio, this issue will be fixed in an upcoming release. The solution for now is to start the Android emulator through the device manager and then the application can be deployed. The ANDROID_HOME variable had to be set through Control Panel as well.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, June 20, 2018 11:51 AM

All replies

  • User21936 posted

    @hkidd

    Are you working on Windows or Mac? I will assume Mac for now as I am not sure this needs to even be set on Windows.

    Did you set ANDROIDHOME in your .bashprofile file or are you setting it manually? If you set that in a bash session, it is only available in that bash session. If you want it to be always available, you need to export the variable in .bash_profile

    try the following:

    1. Open Terminal
    2. enter the command nano .bash_profile
    3. Arrow down to the end of the file
    4. Enter the following, replacing pathToAndroidSDK with the actual absolute path (i.e. starts with / ) to your Android SDK folder:

      export ANDROID_HOME="pathToAndroidSDK"

    5. Press CTL-o to write the changes to the file

    6. Press CTL-x to quit the nano text editor.

    Once that is done, the ANDROID_HOME variable should always be available.

    Wednesday, June 20, 2018 1:20 AM
  • User369313 posted

    @JGoldberger Thanks for your help! I am working on Windows, and the issue is with the tools/emulator to emulator/emulator file path change. According to Visual Studio, this issue will be fixed in an upcoming release. The solution for now is to start the Android emulator through the device manager and then the application can be deployed. The ANDROID_HOME variable had to be set through Control Panel as well.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, June 20, 2018 11:51 AM