Bug 60778 - Unhelpful error message when targeting Framework version v8.0 but not having it installed and using AndroidUseLatestPlatformSdk true
Summary: Unhelpful error message when targeting Framework version v8.0 but not having ...
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 8.1 (15.5)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-11-20 21:17 UTC by Kyle White
Modified: 2017-11-21 21:10 UTC (History)
3 users (show)

Tags:
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 for Bug 60778 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Kyle White 2017-11-20 21:17:44 UTC
The scenario is kind of a mouthful so I'll break it down..

If a user app has:
- <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
- <AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
- Has a reference to a library that was built against v8.0 (for example Xamarin.Android.Support v26.1)

and the build environment does not have Android SDK 26 installed, then the build fails with this error:
>Error APT0000: 1: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. (APT0000)

The problem here is that this error message doesn't indicate anything really useful to the user, it's not clear that the problem is Android SDK 26 is missing.

As expected, flipping AndroidUseLatestPlatformSdk to false, then the build correctly fails and prompts installation of the proper SDK.

From my understanding talking with Peter, I guess the AndroidUseLatestPlatformSdk allows the build to proceed with the latest available which later conflicts with the references already built against v8.0 - I also understand there is a proposal to remove the AndroidUseLatestPlatformSdk flag all together which would prevent this from happening, however I believe (if it's simple enough) it'd be valuable to provide a much better error message in the scenario described until the former removal is fully in place. 

Steps to repro:
1) Remove Android SDK 26
2) Create new Android Single View app in VSmac
3) Set target framework to v8.0 and AndroidUseLatestPlatformSdk
4) Update the Support packages to v26
5) build and observer the error
Comment 1 Jon Douglas [MSFT] 2017-11-20 21:39:23 UTC
I am CONFIRMING this issue as I am aware of the current limitation here as I wrote the initial proposal. I have also added this bug to the backlog for this proposal.

This also falls into a "lack of linting" category in which we should already know that major versions of the support library are not compatible with < MAJOR.VERSION compiled on. i.e. Support v26 requires Android API level 26 and so on. We should be throwing an error in the situation where there is a mismatch. 

There are existing lint rules out there for these items that Android Studio already consumes. Here's the definition with Gradle:

GradleCompatible
----------------
Summary: Incompatible Gradle Versions

Priority: 8 / 10
Severity: Error
Category: Correctness

There are some combinations of libraries, or tools and libraries, that are
incompatible, or can lead to bugs. One such incompatibility is compiling with
a version of the Android support libraries that is not the latest version (or
in particular, a version lower than your targetSdkVersion.)