-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InstallAndroidDependencies
target doesn't install platform-tools and other necessary parts of the SDK.
#7284
Comments
Logs here. |
Hello, it's been a while, any chance this could be triaged? |
@dellis1972 there are some interesting logs like:
Is it possible you can't build Android projects without |
I have no idea. From the log it looks like we are calculating the dependencies correctly.
We will probably need to get someone to look at the SDKManager code to see what is happening. |
@Lauriethefish: is Some of the output of InstallAndroidDependencies.log looks reasonable:
in that we detected that Platform-Tools wasn't present. Yay. What's odd is that the That might point to the problem, though: .NET 6 <platform-tools revision="31.0.3" path="platform-tools" filesystem-path="platform-tools" manifest-url="https://dl.google.com/android/repository/repository2-1.xml" description="Android SDK Platform-Tools" obsolete="False" preview="False" license="android-sdk-license" original-type="generic:genericDetailsType">
<urls>
<url host-os="macosx" host-bits="0" size="13227985" checksum-type="sha1" checksum="15f6f7e97b35994d538a0fc5147ad5fb502ba03d">https://dl.google.com/android/repository/e8b2b4cbe47c728c1e54c5f524440b52d4e1a33c.platform-tools_r31.0.3-darwin.zip</url>
<url host-os="linux" host-bits="0" size="13302579" checksum-type="sha1" checksum="f09581347ed39978abb3a99c6bb286de6adc98ef">https://dl.google.com/android/repository/platform-tools_r31.0.3-linux.zip</url>
<url host-os="windows" host-bits="0" size="11912013" checksum-type="sha1" checksum="26bc02bbd920e8ed461ae526cc4c69d773b72395">https://dl.google.com/android/repository/platform-tools_r31.0.3-windows.zip</url>
</urls>
</platform-tools> The
Platform-tools 33.0.2, meanwhile, comes from
So what we have here is an inconsistency between A potential workaround for @Lauriethefish would be to override things so that platform-tools 31.0.3 is used, e.g. editing the <PropertyGroup>
<AndroidSdkPlatformToolsVersion>31.0.3</AndroidSdkPlatformToolsVersion>
</PropertyGroup> What we need to do is:
|
It is. Looking through the dockerfile I was debugging, msbuild is invoked as root. |
@Lauriethefish: did you try the potential workaround I mentioned, updating your <PropertyGroup>
<AndroidSdkPlatformToolsVersion>31.0.3</AndroidSdkPlatformToolsVersion>
</PropertyGroup> |
I will try it in a few hours and get back to you. |
@jonpryor |
Are you using Do things fare any better if you use .NET 7 instead? The .NET 6
|
I'm not using |
It does seem like we should remove the logic looking for And look for |
Looking at the log, it seems that the
Further up we have
its likely you will need to override |
As the investigation was (partially) verified, I'll assert that the issue is that our various MSBuild properties which control component versions was out of sync with the manifest used for installation. This is something we're still improving (see #9155), but I think that this issue is currently fixed for .NET 8, and our unit tests should help keep things valid. |
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
.NET 6.0.400
Description
When installing the android SDK using the
InstallAndroidDependencies
target, the downloaded SDK is missing key tools, such as aapt andplatform-tools
:This causes a build with the installed SDK to fail with error XA5300, since Xamarin discards your selected SDK directory when it thinks it's invalid. (perhaps a better error message would be great here, but not super important for this issue).
It would be great if this could be fixed since this target is very, very helpful for CI.
Steps to Reproduce
mcr.microsoft.com/dotnet/sdk:6.0
image.su
.sudo dotnet workload install android
.sudo dotnet new android -o example && cd example
.sudo dotnet restore ./example.csproj
InstallAndroidDependencies
to download the SDK:sudo dotnet msbuild ./example.csproj -t:InstallAndroidDependencies -p:AndroidSdkDirectory=/opt/android-sdk -p:AcceptAndroidSDKLicenses=true
sudo dotnet publish -c Release -p:AndroidSdkDirectory=/opt/android-sdk
.You will then receive the error:
/usr/share/dotnet/packs/Microsoft.Android.Sdk.Linux/32.0.448/tools/Xamarin.Android.Tooling.targets(69,5): error XA5300: The Android SDK directory could not be found. Check that the Android SDK Manager in Visual Studio shows a valid installation. To use a custom SDK path for a command line build, set the 'AndroidSdkDirectory' MSBuild property to the custom path. [/home/laurie/example/example.csproj]
Did you find any workaround?
No workaround currently, I tried installing the SDK with
sudo apt-get install -y android-sdk
, but unfortunately that SDK only targets API level 29, and we need API level 31 for net6.0-android.Relevant log output
See comment for diagnostic logs of both
InstallAndroidDepencies
andpublish
.The text was updated successfully, but these errors were encountered: