From 2fb1cbc14cc4929c7bfe2b586205d169544f3a4a Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 1 Jul 2020 20:25:26 +0100 Subject: [PATCH] [Xamarin.Android.Tools.AndroidSdk] Default SDK component versions (#93) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Context: https://issuetracker.google.com/issues/150189789 Context: https://github.com/xamarin/androidtools/commit/3f51412d5f213c0267fc597623f3430437d6452e We have discovered an issue when installing Visual Studio for Mac on macOS: certain versions of the installer will install the *latest* Android SDK Build-tools package, currently r30.0.0. This is a problem because recent versions of Xamarin.Android will use `apksigner` to sign `Mono.Android.Platform.ApiLevel_*.apk` files, so that they can be installed on API-30 targets -- API-30 targets no longer like `jarsigner`-signed `.apk` files -- but the `apksigner` included in the Build-tools r30 package requires JDK 9. Visual Studio for Mac is not ready to migrate to JDK >= 9. Consequently, on such installation environments, the Xamarin.Android shared runtime cannot be created, as `apksigner` won't run: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/apksigner/ApkSignerTool has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0 What we need is a way for the macOS installer to share the same [default Android SDK component versions as Xamarin.Android itself][0]. This *could* plausibly be done by adding a git submodule reference from the xamarin/xamarin-android repo to the macOS installer, but this is undesirable. Instead, both the the xamarin-android repo and the installer repo's have existing git submodules graphs which include the xamarin/xamarin-android-tools repo. Add a new `Xamarin.Android.Tools.Versions.props` file, which contains the default Android SDK component versions, as an MSBuild project file: 29.0.2 … With this file in place, we can update the macOS installer to use `Xamarin.Android.Tools.Versions.props` as the "source of truth" for which versions to install. In particular, we'll set the default Build-tools version to 29.0.2, *not* 30.0.0, thus avoiding the problem with `apksigner` invocations. In the future, when `Xamarin.Android.Tools.Versions.props` is changed *all* repos referencing xamarin/xamarin-android-tools will need to be updated, so that everything can be on the same "page". [0]: https://github.com/xamarin/xamarin-android/blob/5f78740d74e19b235aad62c8ea8e314c9c78ddce/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props.in#L18-L21 --- .../Xamarin.Android.Tools.AndroidSdk.csproj | 5 +++++ .../Xamarin.Android.Tools.Versions.props | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.Versions.props diff --git a/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj b/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj index 81a7a74..bae6585 100644 --- a/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj +++ b/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj @@ -37,4 +37,9 @@ + + + PreserveNewest + + diff --git a/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.Versions.props b/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.Versions.props new file mode 100644 index 0000000..9c016e1 --- /dev/null +++ b/src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.Versions.props @@ -0,0 +1,20 @@ + + + + + 29.0.2 + 1.0 + 29.0.5 + 26.1.1 + + android-29 + 16.1 + + \ No newline at end of file