Jenkins : Xamarin build fails with Android SDK not found

SumitSumit USMember

I am trying to compile (MAC) an Android project using Jenkins and I am getting error mentioned below. Have tried following:

  1. Setting command line argument for MSBUILD : /p:AndroidSdkDirectory=/Users/administrator/Library/Developer/Xamarin/android-sdk-mac_x86
  2. Tried Passing default paramters for Msbuild plugin : /p:AndroidSdkDirectory=/Users/administrator/Library/Developer/Xamarin/android-sdk-mac_x86

Still I keep getting this error. Can any thing else be done to help Msbuild to find Android SDK location.

Project "/Users/Shared/Jenkins/Home/jobs/AndroidBuild/workspace/Droid/GitBuildTest.Droid.csproj" (rebuild target(s)):
    Target _CleanMonoAndroidIntermediateDir:
        Deleting file '/Users/Shared/Jenkins/Home/jobs/AndroidBuild/workspace/Droid/obj/Debug/build.props'
    Target _BuildSdkCache:
: error XA5205: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.
    Task "ResolveSdks" execution -- FAILED
    Done building target "_BuildSdkCache" in project "/Users/Shared/Jenkins/Home/jobs/AndroidBuild/workspace/Droid/GitBuildTest.Droid.csproj".-- FAILED
Done building project "/Users/Shared/Jenkins/Home/jobs/AndroidBuild/workspace/Droid/GitBuildTest.Droid.csproj".-- FAILED

Build FAILED.
Errors:

/Users/Shared/Jenkins/Home/jobs/AndroidBuild/workspace/Droid/GitBuildTest.Droid.csproj (rebuild) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_BuildSdkCache target) ->

    : error XA5205: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.

Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE

Posts

  • rmaciasrmacias USBeta, University ✭✭✭✭✭
    edited March 2016

    /p:AndroidSdkDirectory=/Users/administrator/Library/Developer/Xamarin/android-sdk-mac_x86

    I noticed that your SDK directory is located in the Library of a user named "Administrator". Are you logged in as Administrator and/or is your build instance running under the context of the Administrator user? If not, that that could be your issue as access to the SDK may be denied. I would recommend either running under the logged in user or moving the Android SDK to a shareable location in where all users have access.

  • SumitSumit USMember

    I am logged in as Administrator so that should not be the problem.

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    I'm looking at the folder path for my Android SDK install, and it's a little different than yours. It's possible that you're using a path for an older version of Xamarin Studio, but have a newer version installed that has a different path. Have you verified that the path actually exists? Here's what my path looks like:

    /Users/MyUserName/Library/Developer/Xamarin/android-sdk-macosx

    Notice that the last directory name is "android-sdk-macosx" and not "android-sdk-mac_x86".

  • SumitSumit USMember

    Path exists, have checked it in Xamarin Studio preferences also. I used MacOsX installer for Jenkins, it has created Jenkins account on my machine. I am using default permissions of Xamarin which execute job as Anonymous users.

    Hoping its not a permission issue.

  • Manikandan_SManikandan_S USMember ✭✭

    @rmacias You are Correct.
    @summit Try to move the folder to shared. issue will be solved

  • SumitSumit USMember

    I moved the Android SDK and it resolved the issue. Now I am stuck with another issue
    : error XA9008: Building from the command-line requires a Business License.

    Since its not related to this thread I will close out this thread. Thanks for all your help guys.

Sign In or Register to comment.