Bug 52451 - [FirstRun] Old JDK paths in sdks.cache prevent users from building and resolving project errors when updating JDKs.
Summary: [FirstRun] Old JDK paths in sdks.cache prevent users from building and resolv...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.3.0 (C9)
Hardware: PC Windows
: Normal enhancement
Target Milestone: 4.3.0 (C9)
Assignee: Juan Marcelo Tondato
Depends on:
Reported: 2017-02-10 18:12 UTC by Jon Douglas [MSFT]
Modified: 2017-03-03 21:34 UTC (History)
5 users (show)

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 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 Jon Douglas [MSFT] 2017-02-10 18:12:05 UTC

When users update the JDK from a version such as 1.7 -> 1.8, there is a problem with a previous built project that already includes a `sdks.cache` which is located in the `obj\Debug folder`. This file caches various locations on the PC for use in the build system. One significant issue with this is that if they had built an app prior to updating the JDK, their <JavaSdkPath>(https://github.com/xamarin/xamarin-android/blob/30ebd0d07dd236bca0afb7db347276a2862f77dd/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs#L87) will still have the value of the old JDK and most likely give an error message like the following:

"Java\{OLD JDK VERSION}\bin\java.exe" is invalid.

This is quite confusing for our customers as there's no error message telling the user where that path is coming from. For a user to debug this, they would need a diagnostic build output to see what path is being picked up. Most users get frustrated by this early on and open a Stack Overflow post:




As you can imagine, these three questions are quite different by nature, but they all come down to the same issue which has to deal with a bad cache path.


Create an update mechanic in which if the user changes the JDK Path in their Xamarin settings, it should check against this cache file to ensure they are the same. If they are not, it should clean the bin/obj(force clean/build) or change the value in the cache file to the updated path.
Comment 2 dean.ellis 2017-02-14 13:58:09 UTC
Related to https://bugzilla.xamarin.com/show_bug.cgi?id=32578
Comment 3 xamarin-release-manager 2017-02-14 15:25:13 UTC
Fixed in version (master)

Author: Juan Marcelo Tondato
Commit: 2982dd0948c3a0b35ee2f5d1c220816e7d40e687 (xamarin/XamarinVS)
Comment 4 xamarin-release-manager 2017-02-14 15:25:44 UTC
Fixed in version (cycle9)

Author: Juan Marcelo Tondato
Commit: ab30d7a45a2c33a114583ab00a5865d282b43c38 (xamarin/XamarinVS)