MSBuild vs XBuild Android build fails on XBuild

AidenStrydomAidenStrydom USMember

Hi all.

I have an Android project which, when compiled from the command line, on Windows, under msBuild, compiles and produces an apk successfully.
However when I try compiling the same project on a Mac, under xbuild i get the following:

mobileapps:~ build$ xbuild /p:Configuration=Release /property:DefineConstants="MOCK_SERVICES,DEBUG,SIT1" /verbosity:normal /t:SignAndroidPackage "/Users/build/Desktop/SBG.NBOL.Core/SBG.NBOL.Tablet.Droid/SBG.NBOL.Tablet.Droid.csproj"
XBuild Engine Version 12.0
Mono, Version 4.2.3.0
Copyright (C) 2005-2013 Various Mono authors

Build started 2016-03-31 09:04:02 AM.
__________________________________________________
Project "/Users/build/Desktop/SBG.NBOL.Core/SBG.NBOL.Tablet.Droid/SBG.NBOL.Tablet.Droid.csproj" (default target(s)):
    Target RestorePackages:
        Executing: mono --runtime=v4.0.30319 "../.nuget/NuGet.exe" install "/Users/build/Desktop/SBG.NBOL.Core/SBG.NBOL.Tablet.Droid/packages.config" -source ""   -RequireConsent -solutionDir "../"
        Restoring NuGet packages...
        To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
        Feeds used:
          /Users/build/.local/share/NuGet/Cache
          /Users/build/.nuget/packages/
          https://api.nuget.org/v3/index.json
        All packages listed in /Users/build/Desktop/SBG.NBOL.Core/SBG.NBOL.Tablet.Droid/packages.config are already installed.
    Target _BuildSdkCache:
    Skipping target "_BuildSdkCache" because its outputs are up-to-date.
    Target _CheckProjectItems:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task CheckProjectItems: ApplicationName='C:\Program Files (x86)\MSBuild\Xamarin\Android/mandroid', CommandLine='-d', CurrentDirectory='/', Native error= Cannot find the specified file
        Build FAILED.
        Errors:
        /Users/build/Desktop/SBG.NBOL.Core/SBG.NBOL.Tablet.Droid/SBG.NBOL.Tablet.Droid.csproj (default targets) ->
        /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_CheckProjectItems target) ->
            /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task CheckProjectItems: ApplicationName='C:\Program Files (x86)\MSBuild\Xamarin\Android/mandroid', CommandLine='-d', CurrentDirectory='/', Native error= Cannot find the specified file
             0 Warning(s)
             1 Error(s)
        Time Elapsed 00:00:01.6360070

Currently downloading Mono's MDK again.
Anyone know whats happening here?

Regards

Aiden Strydom

Answers

  • mattwardmattward GBMember Xamurai

    Does your project file use a custom build step or custom MSBuild targets file or have you defined the path to mandroid as a property somewhere? It looks like something is trying to run MonoAndroid on the Mac but is using the path to it as though it was on Windows:

    C:\Program Files (x86)\MSBuild\Xamarin\Android/mandroid
    

    I would try verbosity:diagnostic to see if any properties are defined and also look at the project file to see what is imported.

  • AidenStrydomAidenStrydom USMember

    Hi Matt, thanks for the response. No - no custom build step. And the csproj was copied along all the other files from the windows box to the mac. But i noticed the same reference to mandroid as a windows path. Today's attempt is to condition the build with a osx path

  • AidenStrydomAidenStrydom USMember
    edited April 2016

    So xbuild attempts to execute CheckProjectItems in Xamarin.Android.Common.Targets: the output of the diagnostic build is:

    Target _CheckProjectItems:
        Task "CheckProjectItems"
            Using task CheckProjectItems from Xamarin.Android.Tasks.CheckProjectItems, Xamarin.Android.Build.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
            CheckProjectItems Task
              NativeLibraries:
              JavaLibraries:
              JavaSourceFiles:
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task CheckProjectItems: ApplicationName='C:\Program Files (x86)\MSBuild\Xamarin\Android/mandroid', CommandLine='-d', CurrentDirectory='/', Native error= Cannot find the specified file
            Error executing task CheckProjectItems: System.ComponentModel.Win32Exception: ApplicationName='C:\Program Files (x86)\MSBuild\Xamarin\Android/mandroid', CommandLine='-d', CurrentDirectory='/', Native error= Cannot find the specified file
              at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) <0x31d3380 + 0x00e1b> in <filename unknown>:0 
              at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) <0x31d31f0 + 0x000a7> in <filename unknown>:0 
              at System.Diagnostics.Process.Start () <0x31d3178 + 0x0004f> in <filename unknown>:0 
              at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
              at Xamarin.Android.Tasks.MandroidDaemon.CreateDaemon () <0x31f5150 + 0x003e3> in <filename unknown>:0 
              at Xamarin.Android.Tasks.MandroidDaemon.GetStandardInput_Locked () <0x31f50d0 + 0x0001f> in <filename unknown>:0 
              at Xamarin.Android.Tasks.MandroidDaemon.SendCommand (Microsoft.Build.Utilities.Task task, System.String[] commands, System.Action`1 response) <0x31f4930 + 0x00307> in <filename unknown>:0 
              at Xamarin.Android.Tasks.MandroidDaemon.GetEdition (Microsoft.Build.Utilities.Task task) <0x31f47d8 + 0x000eb> in <filename unknown>:0 
              at MSBuildExtensions.GetLicenseEdition (Microsoft.Build.Utilities.Task task) <0x31f47a8 + 0x00013> in <filename unknown>:0 
              at Xamarin.Android.Tasks.CheckProjectItems.Execute () <0x31f4378 + 0x001df> in <filename unknown>:0 
              at Microsoft.Build.BuildEngine.TaskEngine.Execute () <0x31ccf28 + 0x00018> in <filename unknown>:0 
              at Microsoft.Build.BuildEngine.BuildTask.Execute () <0x310d830 + 0x00257> in <filename unknown>:0 
            Done building target "_CheckProjectItems" in project "/Users/build/Desktop/SBG.NBOL.Core/SBG.NBOL.Tablet.Droid/SBG.NBOL.Tablet.Droid.csproj" ("/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets"); "Build" depends on it.
            Done building target "Build" in project "/Users/build/Desktop/SBG.NBOL.Core/SBG.NBOL.Tablet.Droid/SBG.NBOL.Tablet.Droid.csproj" ("/Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/4.5/Microsoft.Common.targets").
    

    The excerpt from Xamarin.Android.Common.targers

    <!-- project item consistency check -->
    <Target Name="_CheckProjectItems"
        DependsOnTargets="_SetLatestTargetFrameworkVersion">
      <CheckProjectItems
          IsApplication="$(AndroidApplication)"
          JavaSourceFiles="@(AndroidJavaSource)"
          JavaLibraries="@(AndroidJavaLibrary)"
          NativeLibraries="@(AndroidNativeLibrary)"
          EmbeddedNativeLibraries="@(EmbeddedNativeLibrary)" />
    </Target>
    

    And the associative error (taken from above) for JavaSourceFiles is:

    JavaSourceFiles:
        /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task CheckProjectItems: ApplicationName='C:\Program Files (x86)\MSBuild\Xamarin\Android/mandroid', CommandLine='-d', CurrentDirectory='/', Native error= Cannot find the specified file
    

    Busy reinstalling Xamarin on the Mac.
    Here's to hoping.

  • mattwardmattward GBMember Xamurai

    If that does not work I would file a bug on bugzilla with the full diagnostic output and the details about what version of Xamarin.Android you have installed.

Sign In or Register to comment.