-
Notifications
You must be signed in to change notification settings - Fork 526
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 does not install platforms or build-tools components on Windows #4677
Comments
Maybe a fix could be to adjust |
…Dependencies/> Fixes: dotnet#4677 `<CalculateProjectDependencies/>` was always using `/` as the path separator for the `build-tools` and `platforms` output items: Task "CalculateProjectDependencies" Task Parameter:TargetFrameworkVersion=v10.0 Task Parameter:ManifestFile=C:\Source\xamarin-android\bin\TestDebug\temp\InstallAndroidDependenciesTest\Project\Properties\AndroidManifest.xml Task Parameter:BuildToolsVersion=29.0.2 Task Parameter:PlatformToolsVersion=29.0.5 Task Parameter:ToolsVersion=26.1.1 Task Parameter:NdkVersion=16.1 Task Parameter:NdkRequired=False Output Item(s): AndroidDependency= platforms/android-29 build-tools/29.0.2 Version=29.0.2 platform-tools Version=29.0.5 tools Version=26.1.1 Done executing task "CalculateProjectDependencies". This meant the commercial `<InstallAndroidDependencies/>` task wouldn't ever install the `build-tools` or `platforms` components on Windows because none of the candidate `IAndroidComponent.FileSystemPath` values that were available via the SDK installer matched the input `ITaskItem.ItemSpec` values. Fix this by changing `<CalculateProjectDependencies/>` to use `Path.Combine()` instead of `/`. Test changes: `InstallAndroidDependenciesTest` did not yet enforce the expected behavior for this bug because `<ResolveSdks/>` was automatically falling back to the default Android SDK installation. Update `InstallAndroidDependenciesTest` to enforce the expected behavior. To minimize download requirements for the test, add a mock `tools/source.properties` file to the target `android-sdk` directory during each test run. This reduces the total downloads from about 1 GB to under 100 MB, and, because the `tools` component isn't needed for the current default project configuration, `b.Build (proj)` still completes successfully.
Release status update I have locally verified that the non-public fix from https://github.com/xamarin/android-sdk-installer/commit/2b4d1a6a4c49c3bc3fc9751726d854d75c617434, included in 2cf80f5 resolves this issue. A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix. Fix included in Xamarin.Android SDK version 11.1.0.15. Fix included on Windows in Visual Studio 2019 version 16.8 Preview 4. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.8 Preview 4. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Release status update A new Release version of Xamarin.Android has now been published that includes the fix for this item. Fix included in Xamarin.Android SDK version 11.1.0.17. Fix included on Windows in Visual Studio 2019 version 16.8. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/. Fix included on macOS in Visual Studio 2019 for Mac version 8.8. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. |
Example steps to reproduce
Adjust the
InstallAndroidDependenciesTest
to assert that the target Android SDK install directories are created:Expected behavior
The test passes when running on Windows. The corresponding build log should include lines that start with:
and some lines like:
Actual behavior
The test fails on Windows. The build does not include any
Downloading archive
orInstalling Android SDK component
lines. Instead it shows:Preliminary investigation
This appears to be a path separator issue. I tried an experiment where I replaced
dependency.ItemSpec
withstring.Join ("\\", dependency.ItemSpec.Split ('/'))
in the commercial<InstallAndroidDependencies/>
task. That allowed theDownloading archive
andInstalling Android SDK component
messages to appear as expected.Version info
xamarin/android-sdk-installer@4ce982e5b50be23a7df2d3f244e325c2b82254c9
The text was updated successfully, but these errors were encountered: