Skip to content

Making nuget package with aar file always has first resource file corrupted #8988

Closed
dotnet/android-libzipsharp
#142
@Basewq

Description

@Basewq

Android application type

.NET Android (net7.0-android, net8.0-android, etc.)

Affected platform version

VS 2022 17.9.6, Android Manifest Version: 34.0.52/8.0.100

Description

I am trying to make a nuget library in .net8-android that include android resource files to a nuget package (packaged into the aar file), but the first resource file in the aar can't be extracted (always the first file no matter the content).
If I try to extract all contents of the aar with 7z to inspect, every file extracts fine except the first resource file. In 7z, the error only says
Headers Error: res\values\file1.xml
(This will then just 'extract' as an empty file)

Attached is the simplest example
AndroidLibTest.zip
For a quick glance, below is a screenshot of the project layout:
_android

I have seen other libraries that have aar files, and all contents can be extracted without issue in 7z, so I don't think this is a 7z issue.

Steps to Reproduce

  1. See zip attachment above for the project.
  2. Run dotnet pack, or Pack via Visual Studio.
  3. Extract the nuget package with 7z (or whatever)
  4. Try extract AndroidNugetTest.1.0.0\lib\net8.0-android34.0\AndroidNugetTest.aar

Did you find any workaround?

Not tested, but maybe make a dummy/sacrificial resource file that's always the first one to ensure it's the only one corrupted?

Relevant log output

No response

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions