Android SDK not found

ICTACSIICTACSI NLMember, University

I am running the xamarin emulator.
I ran the CreditCard sample project on the emulator, so that is installed.
When I run my test project I get the error:
TestCase : System.Exception : 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.

What do I need to set to get the project going.
Where should my app that i want to test be?

My code so far looks like this:

` [TestFixtureSetUp]
public void TestFixtureSetup()
{
string currentFile = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
string dir = new FileInfo(currentFile).Directory.Parent.Parent.Parent.FullName;

         PathToApk = Path.Combine(dir, "CreditCardValidation.Droid");
     }

     [SetUp]
     public void SetUp()
     {
         _app = ConfigureApp.Android.ApkFile(PathToApk).ApiKey("12345").StartApp();
     }

     [Test()]
     public void TestCase()
     {
         _app.Query(c => c.Id("txtUserName"));

         var results = _app.Query(c => c.All());
     }`

Posts

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai
    edited November 2014

    This is a known issue at the moment. Depending on the circumstances, UITest might not be able to resolve the directory that the Android SDK is installed in.

    If you look inside the test class, you will see a method named CheckAndroidHomeEnvironmentVariable. You will need to make a slight change to that method. Update line 135 with the path to your Android SDK and set the variable LocalTestsUsingiOS to false.

  • ICTACSIICTACSI NLMember, University

    But I am correct in assuming that when I run within visual studio, the apk being search for is the one on my local system and not the one installed on the device.

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai

    According to your error message, the problem is that UITest can't find the Android SDK, which it needs to to install the APK on the device in the first place.

    In the case of Android, I believe that UITest will always install the APK from disk over the version on the device/emulator , but I'm not 100% sure on that - @RasmusKromann-Larsen‌ would know the answer.

  • ICTACSIICTACSI NLMember, University

    I am running on a Windows system. I changed the line to where my SDK is, but I still get the error.
    My path: public static readonly string PathToAndroidSdk = @/Users/USERNAME/AppData/Local/Android/android-sdk;

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai

    Try the fully qualified Windows path, i.e. C:\Users\USERNAME\AppData\Local\ANdroid\Android-sdk.

  • ICTACSIICTACSI NLMember, University

    Tried that, didn't work either. I 'm now using Xamarin studio, in there it does work.

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai

    So it didn't work in Visual Studio, but it does in Xamarin Studio? That is starting to sound like a bug. Can I ask you to log a bug so that we can give it a proper look?

  • Vikram_BVikram_B USMember ✭✭

    Hi @Tom Opgenorth,

    Could you please share the information how you set the path for Android in Xamarin studio any snapshorts for my reference to check in my Xamarin studio.

  • NusairiNusairi GBMember

    I am having same issue any resolution ?

    Message: SetUp : System.Exception : 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.

  • LewisKLewisK USUniversity ✭✭
    edited November 6

    @Nusairi said:
    I am having same issue any resolution ?

    Message: SetUp : System.Exception : 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.

    Assuming you have tried the instructions?

Sign In or Register to comment.