Skip to content

Migrating AndroidX packages to <AndroidLibrary> #9299

Closed
@jpobst

Description

(I made this an issue so I can provide context and we can determine the best way forward.)

Today, the AndroidX packages for an .aar we bind operate like this:

  • cake unzips the .aar into a directory
  • The project templates produces bindings using <InputJar Include="$(extracted_dir)/classes.jar" /> (which will not ship the Java binary)
  • The .aar is added to the NuGet package with <None>
  • A .targets file is added to the NuGet package which does the following:
    • Adds the .aar to the application with <AndroidAarLibrary>

Presumably this was done to in the past to speed up user application builds instead of embedding the .aar as a resource in the .dll.

We would like to remove this "hack" and use <AndroidLibrary> and no .targets file.

However, when using <AndroidLibrary> and $(AndroidGenerateResourceDesigner)=false, we end up getting errors processing Android resources with aapt:

c:\code\AndroidX\generated\androidx.preference.preference\obj\Release\net8.0-android\lp\93\jl\res\color\abc_btn_colored
_text_material.xml(21): error APT2260: attribute alpha (aka Xamarin.AndroidX.Preference:alpha) not found. [c:\code\Andr
oidX\generated\androidx.preference.preference\androidx.preference.preference.csproj::TargetFramework=net8.0-android]

The difference is that the current .targets-based binding project never processes Android resources. The consuming application would be responsible for processing them.

Should <AndroidLibrary> be processing the Android resources in a binding project? Is there a way to opt out of the processing? Or is there another way we should be going about this?

Original package example:

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions