Bug 39814 - Android App Project created in Visual Studio 2015 doesn't compile in Xamarin Studio
Summary: Android App Project created in Visual Studio 2015 doesn't compile in Xamarin ...
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 6.0.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-03-21 15:59 UTC by Tom Opgenorth
Modified: 2016-03-22 22:20 UTC (History)
1 user (show)

Tags: papercut
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Tom Opgenorth 2016-03-21 15:59:44 UTC
I created an Android app in Visual Studio 2015. When I go to open the same solution in Xamarin Studio and build or run the Android app, the Android project will not build due to the following error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Could not find android.jar for API Level 23. This means the Android SDK platform for API Level 23 is not installed. Either install it in the Android SDK Manager (Tools > Open Android SDK Manager...), or change your Xamarin.Android project to target an API version that is installed. (C:/Program Files (x86)/Android/android-sdk/platforms/android-23/android.jar missing.) (BackdoorActivity)

Steps to duplicate:

1. On a Windows PC, ensure that you have Android API Level 23 and API Level 16 installed.
2. Create a new Android application in Visual Studio. Set the min SDK to API Level 16, the Target API Level to 23, and the build API level to 23.
3. Build and run the application in Visual Studio 2015 to confirm it works.
4. Optional - Copy the solution folder over to a Mac (not necessary if using shared folders on VMware Fusion).
5. On OS X, ensure that Android API Level 23 and API Level 16 are both installed.
6. Open the solution in Xamarin Studio.
7. Build the application in Xamarin Studio. At this point the build error will occur.

Information about Xamarin Studio:
=== Xamarin Studio ===

Version 5.10.3 (build 26)
Installation UUID: ad9490ea-6efe-4d0a-9649-80d5ac155ab4
	Mono 4.2.3 (explicit/832de4b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402030004

=== Xamarin.Profiler ===

Location: /Applications/XamarinProfiler.Mac.app/Contents/MacOS/XamarinProfiler.Mac

=== Apple Developer Tools ===

Xcode 7.2.1 (9548.1)
Build 7C1002

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 58ba2bc
Branch: master
Build date: 2016-03-03 09:05:19-0500

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/tom/android-sdk-macosx
	Supported Android versions:
		4.1    (API level 16)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 25.0.10
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 24 rc2

Java SDK: /usr
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 510030026
Git revision: ac9b7fcba9ee92ac30c8eb90f20c2228ce033efa
Build date: 2016-03-01 18:02:09-05
Xamarin addins: 633fde3bf405e3c402a51980976c431c204cf4f6
Build lane: monodevelop-lion-cycle6-c6sr2

=== Operating System ===

Mac OS X 10.11.3
Darwin bushmaster.local 15.3.0 Darwin Kernel Version 15.3.0
    Thu Dec 10 18:40:58 PST 2015
    root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64

Information about Visual Studio:

Microsoft Visual Studio Professional 2015
Version 14.0.24720.00 Update 1
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Professional

Visual Basic 2015   00322-50050-63294-AA120
Microsoft Visual Basic 2015

Visual C# 2015   00322-50050-63294-AA120
Microsoft Visual C# 2015

Visual C++ 2015   00322-50050-63294-AA120
Microsoft Visual C++ 2015

Visual F# 2015   00322-50050-63294-AA120
Microsoft Visual F# 2015

Windows Phone SDK 8.0 - ENU   00322-50050-63294-AA120
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   4.3.60226.3
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015 (RC1 Update 1)   14.1.20203.0
ASP.NET and Web Tools 2015 (RC1 Update 1)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Azure App Service Tools v2.7.1   14.0.11112.0
Azure App Service Tools v2.7.1

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JetBrains ReSharper Ultimate 10.0.1   Build 104.0.20151114.160203
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2016 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Python Tools for Visual Studio   2.2.31124.00
Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.

Python Tools for Visual Studio - Django Integration   2.2.31124.00
Provides templates and integration for the Django web framework.

Python Tools for Visual Studio - Profiling Support   2.2.31124.00
Profiling support for Python projects.

SQL Server Data Tools   14.0.50730.0
Microsoft SQL Server Data Tools

TypeScript for Microsoft Visual Studio

Visual Studio Tools for Apache Cordova   Update 7
Visual Studio Tools for Apache Cordova

Visual Studio Tools for Universal Windows Apps   14.0.24720.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (1cc3a99)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (46c3f7e)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (686b410)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Greg Munn 2016-03-21 16:10:10 UTC
Hey, did you open the project in mac from a shared folder? You might need to clean?
Comment 2 dean.ellis 2016-03-21 16:12:44 UTC

I assume you copied the obj/bin folders as well? If so the build cache is probably out of date. If you do a clean/build I assume it fixes the issue?
Comment 3 Tom Opgenorth 2016-03-21 16:18:48 UTC
Correct. In my case I use VMware Fusion and I shared the directory with my Windows install.

I manually deleted the bin/obj directories, and that fixed the problem.
Comment 4 Tom Opgenorth 2016-03-21 16:26:36 UTC
Debatable, it makes for a poor UX if the user has to manually delete bin/obj directories before switching IDE's works (that's the root problem).
Comment 5 Greg Munn 2016-03-21 16:29:23 UTC
You effectively moved the entire project from one platform to another different platform. A clean seems like a reasonable thing to do. In any case, it's outside of the IDE's hands - these are caches from the build and not the responsibility of the IDE.
Comment 6 Tom Opgenorth 2016-03-21 17:10:35 UTC
Interesting, after the deleting the bin/obj directories, I seem to be able work between the two IDE's without any problems (i.e. I don't have to delete the bin/obj directories after switching IDEs).

It seems the issue happens the first time I switch from VS -> XS.
Comment 7 Jonathan Pryor 2016-03-22 22:20:57 UTC
The problem is that certain cache files are (will be?) created within the obj directory that contains system-specific locations.

For example, `obj\Debug\sdks.cache` contains the location of the various things, which are inherently OS specific:

  <?xml version="1.0" encoding="utf-8"?>

Unless you're running the same OS on both sides of the VM, with the same installation paths, everything will break unless you nuke the obj directory.