Skip to content

[Xamarin.Android.Build.Tasks] error for Android.Support #8621

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

Conversation

jonathanpeppers
Copy link
Member

Context: #8478

Some hardcoded paths/properties in Xamarin.AndroidX.Migration cause tests failures in #8478 such as:

(_AndroidXCecilfy target) ->
/Users/runner/.nuget/packages/xamarin.androidx.migration/1.0.8/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : Source assembly does not exist: 'obj/Debug/android/assets/UnnamedProject.dll'.

Where $(MonoAndroidIntermediateAssetsDir) does not account for a new architecture in the path:

<ItemGroup>
  <_AndroidXFileToCecilfy Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssetsDir)%(Filename)%(Extension)')"
    Condition="('%(ResolvedUserAssemblies.TargetFrameworkIdentifier)' == 'MonoAndroid' or '%(ResolvedUserAssemblies.HasMonoAndroidReference)' == 'true') and ('%(ResolvedUserAssemblies.AndroidXSkipAndroidXMigration)' != 'true')" />
</ItemGroup>

We don't really support the old Android.Support libraries or AndroidX.Migration, but we don't have any build warnings or errors in place for this.

Introduce a XA1039 error if any Android.Support.* packages are found and see what happens?

Depending on how bad/impactful this is, we may decide to scope this to the AndroidX.Migration package instead.

@jonathanpeppers jonathanpeppers force-pushed the RemoveSupportForAndroidSupport branch 5 times, most recently from fb94129 to c11f9fd Compare January 11, 2024 15:02
Context: dotnet#8478

Some hardcoded paths/properties in Xamarin.AndroidX.Migration cause
tests failures in dotnet#8478 such as:

    (_AndroidXCecilfy target) ->
    /Users/runner/.nuget/packages/xamarin.androidx.migration/1.0.8/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : Source assembly does not exist: 'obj/Debug/android/assets/UnnamedProject.dll'.

Where `$(MonoAndroidIntermediateAssetsDir)` does not account for a new
architecture in the path:

    <ItemGroup>
      <_AndroidXFileToCecilfy Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssetsDir)%(Filename)%(Extension)')"
        Condition="('%(ResolvedUserAssemblies.TargetFrameworkIdentifier)' == 'MonoAndroid' or '%(ResolvedUserAssemblies.HasMonoAndroidReference)' == 'true') and ('%(ResolvedUserAssemblies.AndroidXSkipAndroidXMigration)' != 'true')" />
    </ItemGroup>

We don't really *support* the old Android.Support libraries or
AndroidX.Migration, but we don't have any build warnings or errors in
place for this.

Introduce a `XA1039` error in .NET 9 if any packages are found matching:

* `Xamarin.Android.Support.*`
* `Xamarin.Android.Arch.*`

The biggest impact here is going to be many of our old tests, which
use the support libraries in various forms.

Improvements & general cleanup:

* Removed all old/unused packages in `KnownPackages.cs`

* Updated `KnownPackages.cs` to latest versions, including Xamarin.Forms

* Android Wear tests are now migrated from support to AndroidX:

https://android-developers.googleblog.com/2016/04/build-beautifully-for-android-wear.html

* `CheckEmbeddedSupportLibraryResources` -> moved to AndroidX

* `BuildHasNoWarnings` was not appropriately applying `IsRelease`.

* `Android.Support.v8.RenderScript` removed in favor of inline `.so` file.

* A few tests that used support libraries to create a project large
  numbers of dependencies, moved to `XamarinFormsAndroidApplicationProject`.

* `ResolveLibraryProjectImports` -> sorted comparisions

* `XamarinFormsAndroidApplicationProject` has a workaround for Guava:

dotnet/android-libraries#535

Removed tests:

* `AndroidXMigration`, `AndroidXMigrationBug`

* `ResolveLibraryImportsWithReadonlyFiles`, seemed duplicate of other
  Android Wear tests, and used support libraries.

* `ExtraAaptManifest` as it depends on `Xamarin.Android.Fabric` and
  `Xamarin.Android.Crashlytics`. These are deprecated and depend on
  support libraries.

* `BuildProguardEnabledProjectSource` now only tests `Release` mode.
  Since updating to AndroidX, `Debug` mode was triggering multi-dex.
  Making it difficult to assert contents of `*.dex` files.

In a future PR, we will backport these changes, but downgrade the error
to a warning:

    --<AndroidError Code="XA1039"
    ++<AndroidWarning Code="XA1039"
        ResourceName="XA1039"
        FormatArguments="9"
        Condition=" '@(_AndroidUnsupportedPackages->Count())' != '0' "
    />
@jonathanpeppers jonathanpeppers force-pushed the RemoveSupportForAndroidSupport branch from 3e7e439 to d053553 Compare January 11, 2024 18:33
@jonathanpeppers
Copy link
Member Author

Closing in favor of a non-fork PR: #8629

@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant