29

A few days ago my solution seemed to work fine, but today all of the sudden the Android project doesn't build. I get no Error, but I do get the following output:

1>Build started.
1>Project "MyApp.Android.csproj" (Install target(s)):
1>Project "MyApp.csproj" (GetTargetFrameworks target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetFrameworks target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetPath target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetTargetPath target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetNativeManifest target(s)):
1>Done building project "MyApp.csproj".
1>Project "MyApp.csproj" (GetNativeManifest target(s)):
1>Done building project "MyApp.csproj".
1>"obj\Debug\MyApp.Android.dll;obj\Debug\MyApp.Android.dll" is an invalid value for the "OutputAssembly" parameter of the "Csc" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".
1>Done building project "MyApp.Android.csproj" -- FAILED.
1>Build FAILED.

I also tried to delete the bin en obj folders, clean and rebuild the Solution and deleting the MyApp.Android.dll. But after the Rebuild the exact same thing happens again.

I do get the following warning:

Severity    Code    Description Project File    Line    Suppression State
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.   BarApp.Android      1   Active
JeroenM
  • 735
  • 1
  • 9
  • 25
  • 1
    In your Project set Linking to `Sdk Assemblies Only` and check support architecture for `armeabi - v7` and `x86`. – Harshad Pansuriya Dec 12 '17 at 10:57
  • Thanks! I already had everything in your answer, but I also had "Armeabi" checked (without the -v7), so I unchecked it and now it works (: If you post it as answer I'll accept it. – JeroenM Dec 12 '17 at 11:04

4 Answers4

39

You have to set your Project Linking to Sdk Assemblies Only and set support architecture to armeabi - v7 and x86.

after try to clean and rebuild the project

It work like charm.

Harshad Pansuriya
  • 17,218
  • 7
  • 58
  • 86
  • 1
    Where do we set the support architecture? – Ayudh Apr 22 '18 at 10:41
  • 2
    Can you please explain why? This problem happened to me after migrated my `Portable class library` to `.net standard` and updated the .net standard package to 2.0.2. What are those architectures? – Mahmoud May 07 '18 at 14:24
  • I also started getting this after upgrading to .Net Standard 2.0 from PCL. We have linking turned off in out project (had problems with it in the past). One I start getting this problem I have to restart visual studio and then I can usually go a few hours without encountering it again. It is really annoying to have to restart so often. – Chris Gonzales Jul 27 '18 at 15:11
  • Getting this error after an update to VS 2019 16.2.5. The above changes do not fix the problem for me. :( – pettys Sep 19 '19 at 18:40
  • 1
    @pettysI've had the same issue, some clean and rebuild helped :/ – Codrina Valo Sep 19 '19 at 20:51
  • @pettys: I had to restart my PC including VS and now it works. Clean and rebuild was not enough. – testing Feb 11 '20 at 14:33
  • 1
    @Ayudh Click the "Advanced" button on the Properties / Android Options tab. – Max Szczurek Nov 19 '20 at 17:53
5

If you are using the portable class library (PCL) approach to organize your code between Android and iOS, you can unload the Android project by right-clicking it and selecting menu option "Unload Project" in Visual Studio. Then recompile the PCL project, reload the Android project again (right click -> "Reload Project") and rebuild the solution. This time it should give no error. Now try to run the app again on Android emulator.

You may have to also restart the emulator and uninstall the app from the emulator/device before being able to run it succesfully again.

Ulysses Alves
  • 1,960
  • 1
  • 18
  • 32
2

Open project in File Explorer, delete bin and obj file from the solution, go to the solution.

  1. Right click in droid project go to option

  2. Select Android option set your Project Linking to SDK Assemblies Only and click advanced set support architecture to armeabi-v7 and x86.

  3. Finally to clean and rebuild the project.

Aniruddh Parihar
  • 2,524
  • 1
  • 16
  • 32
Wonde_Man
  • 29
  • 6
1

I had to clean the project, delete the bin folder (just to be sure), then the build failed with the real reason: an incorrect reference.

Someone copied a project dll instead of linking to the project.

Corrected the reference and all was well.

Atron Seige
  • 2,010
  • 2
  • 25
  • 31