Forum Visual Studio

Unable to build Android Project with latest 7.5 (build 1254)

magic67magic67 USMember ✭✭✭

After upgrading VS2017 this morning to latest stable, I can no longer build the Android project in PCL solution - iOS builds fine.

I have tried the following

  • delete .nuget cache
  • delete bin & obj folders
  • delete Packages folder

Restore Nuget packages and build solution.

The build process fails with the following message

Error: Could not load file or assembly 'NuGet.Common, Version=4.6.0.0, Culture=neutral, PublicKeyToken=' or one of its dependencies.
at Xamarin.Android.Tasks.ResolveAssemblies.b__44_0 () [0x0000e] in :0
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2886
at System.Threading.Tasks.Task.Execute () [0x00010] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2509

Can anyone shed any light on this error?
This project has been compiling for the last 12 months and this is the first time I've come across this error.

Best Answer

  • magic67magic67 USMember ✭✭✭
    Accepted Answer

    @BrendanZagaeski Development on Xamarin had come to an almost complete stop.
    These were the steps I took to get things working again

    Created a new Standard Mac User, ran VS2017 and veriied that the project compiled, Archives were built on both iOS and Android. So at least I knew there was something wrong in my users library folder.

    So under my current user I did a search through
    /Library/Applcation Support/
    /Library\Developer/
    /Library\Preferences/

    I deleted anything to do with Xamarin, XamarinStudio60, Visual Studio etc BUT not Developer\Xamarin\Keystore or Developer\Xamarin\Google Play Store

    I also deleted this folder
    /Library/Caches/VisualStudio/7.0/addin-db-002

    Downloaded VS installer and now the dev environment seems to be working again.

Answers

  • steviet02steviet02 USMember ✭✭

    Same exact issue and error here....

  • steviet02steviet02 USMember ✭✭

    It looks like the path /Users/builder/jenkins/workspace/build-package-osx-mono.... is just wrong. There aren't any builder folders in the top level Users folder on my machine at least.

  • steviet02steviet02 USMember ✭✭

    If you're willing to switch channels, go to the beta channel and the issue is already fixed there. Really strange how that got through and into a stable build.

  • BlakeRossBlakeRoss USMember ✭✭

    I've got the same issue after updating today. Builds have run just fine up until this version. Looks like I'll have to downgrade back to the previous one until it's resolved in the next stable release.

  • magic67magic67 USMember ✭✭✭
    edited May 2018

    @steviet02 > If you're willing to switch channels, go to the beta channel and the issue is already fixed there.

    So it's a known bug or does someone still need to report it?

  • magic67magic67 USMember ✭✭✭

    The old link to create a support incident now goes here?
    https://www.visualstudio.com/vs/support/mac/

  • magic67magic67 USMember ✭✭✭

    @steviet02 I switched to the beta channel - it didn't fix the problem for me

  • NS2411NS2411 USMember ✭✭

    I'm having the same problem, I switched to the beta channel and it didn't fix the issue for me either.

    This is unacceptable, but still a really good summation of my experience using this tool ... //sigh ...

  • danhompdanhomp Member

    Same issue here. Any workaround until it gets fixed?

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Possibly relevant Visual Studio Developer Community cross-reference: https://developercommunity.visualstudio.com/content/problem/247933/cant-build-android-projects-on-vs-mac-75-build-125.html

    For the original reporter on that item, the user found that changing back from project.json to packages.config resolved the issue. That report also contains some other discussion with the engineering team that might provide some additional clues in troubleshooting this issue.

    If that information does not resolve the issue for anyone on this thread and anyone can provide some details like the discussion in that other issue, please do Report a Problem. (I didn't find any existing reports about the specific name "NuGet.Common" in Developer Community.) Thanks in advance!

  • magic67magic67 USMember ✭✭✭

    @BrendanZagaeski Thnxs for the update and the possible solution.
    I have not upgraded the project to the .net standard and still use packages.config, so this solution didn't really apply in my case.

    I was able to get my dev environment working again by following your instructions here to reinstall the Xamarin frameworks.
    https://forums.xamarin.com/discussion/123413/install-previous-version-of-visual-studio-for-mac#latest

    However the updated VS 7.5 would not launch, it would just bounce a couple of times and quit.
    Console was reporting the following -
    com.apple.xpc.launchd[1] (com.microsoft.visual-studio.16244[5238]): Service exited with abnormal code: 255

    So I reinstalled VS 7.4.2 from Time Machine and now its working again.

    If I have some time, I'll install the latest VS on another machine and see if I can replicate the issue and file a Report.

  • steviet02steviet02 USMember ✭✭

    @magic67 said:
    @steviet02 > If you're willing to switch channels, go to the beta channel and the issue is already fixed there.

    So it's a known bug or does someone still need to report it?

    Sorry I just saw the responses...

    It wasn't clear if this had something to do with the path that I mentioned before or the fact that I installed Android Studio to test an Android Things issue I was having. There is a known issue surrounding Xamarin not finding the SDK if it was installed by Android Studio. Wasn't really sure if that was the solution/issue or not. But my machine at home isn't having this issue and I hadn't installed Android Studio. Glad to see you got it worked out, but it's painful sometimes. https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-mac-preview-relnotes

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Cross-referencing note:

    A user on another forum thread was able to resolve this issue by switching Visual Studio for Mac to use msbuild rather than xbuild to build the project: https://forums.xamarin.com/discussion/comment/330745/#Comment_330745.

  • seansparkmanseansparkman USInsider, University, Developer Group Leader mod

    The beta channel took away the option to use xbuild vs msbuild, so I am going to assume it's doing msbuild. Updating to the beta version has not helped either.

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Another possible cause of this issue is if the Project > Active Runtime setting for the solution is not set to the current Mono Framework MDK version. For example, the combination of Xamarin.Android version 8.3 with the old Mono Framework MDK version 5.4.1 set under Project > Active Runtime will produce this error. I have now reported a problem to request warnings when the Active Runtime setting does not match the Mono Framework MDK version used to launch Visual Studio for Mac.

  • stompkinsstompkins Member
    edited May 2018

    @BrendanZagaeski said:
    Cross-referencing note:

    A user on another forum thread was able to resolve this issue by switching Visual Studio for Mac to use msbuild rather than xbuild to build the project: [forum account too new to post links, scroll up to @BrendanZagaeski post ].

    FWIW, this worked for us; changing xbuild to msbuild in our ant build scripts.

  • magic67magic67 USMember ✭✭✭

    @BrendanZagaeski
    I tried the various fixes suggested

    I was still unable to compile the Android project without downgrading to previous version.

  • TimSaeleeTimSaelee USMember ✭✭
    edited May 2018

    @magic67
    I'm not sure this is going to help you but I was in a similar situation. I upgraded to 7.5 and iOS and Android no longer compiled into my test devices.

    I followed @BrendanZagaeski's post https://forums.xamarin.com/discussion/comment/330292#Comment_330292 and download these packages. Then I just ran them (I did not need to downgrade VS or Mono):

    xamarin.android-8.2.5-0.pkg found here: https://jenkins.xamarin.com/view/Xamarin.Android/job/xamarin-android-builds-d15-6/

    xamarin.ios-11.9.1.23.pkg found here: https://jenkins.xamarin.com/view/Xamarin.MaciOS/job/xamarin-macios-builds-xcode9.3/

    After you install both packages, open VS2017 (it may ask you to upgrade those packages again...don't upgrade). Clean your project and build again. It worked for me and I can debug on my iOS and Android device again, hope it works for you!

  • PhilipJohnPhilipJohn USMember ✭✭

    For others with the same problem, I also discovered this problem today having not done an Android build for quite some time. I uninstalled/reinstalled Xamarin Android with no success, but installing Xamarin.Android 8.2.5 per @TimSaelee's link worked for me.

  • magic67magic67 USMember ✭✭✭

    @TimSaelee I upgraded VS to latest 7.5.2.40 hoping problem would be fixed, unfortunately it is still broken ?
    I re-installed xamarin-android to 8,2,5 with the link you provided and I at least can still build android.
    Still don't know why I'm stuck at this version and can't use latest xamarin.android?

  • magic67magic67 USMember ✭✭✭

    @TimSaelee Now Intellisense is broken - reverted back to VS 7.4 and Intellisense works again.
    Is there a way to install VS for mac just a user, that way I could create a new user and see if a fresh install works?

  • magic67magic67 USMember ✭✭✭
    Accepted Answer

    @BrendanZagaeski Development on Xamarin had come to an almost complete stop.
    These were the steps I took to get things working again

    Created a new Standard Mac User, ran VS2017 and veriied that the project compiled, Archives were built on both iOS and Android. So at least I knew there was something wrong in my users library folder.

    So under my current user I did a search through
    /Library/Applcation Support/
    /Library\Developer/
    /Library\Preferences/

    I deleted anything to do with Xamarin, XamarinStudio60, Visual Studio etc BUT not Developer\Xamarin\Keystore or Developer\Xamarin\Google Play Store

    I also deleted this folder
    /Library/Caches/VisualStudio/7.0/addin-db-002

    Downloaded VS installer and now the dev environment seems to be working again.

  • TimSaeleeTimSaelee USMember ✭✭

    @magic67 So it was a conflict with the old Xamarin Studio before Visual Studio took over? Glad you got it working again, good to know!

  • ChristopherStephanChristopherStephan DEMember ✭✭
    edited June 2018

    Got the same error when building an Android project with xbuild (XBuild Engine Version 14.0 Mono, Version 5.10.1.0) from command line. Error did not occur using msbuild (version 15.6.0.0).

  • magic67magic67 USMember ✭✭✭

    @ChristopherStephan did you try switching build options to MSBuild as suggested by Brendan Zagaeski

Sign In or Register to comment.