Transitive native library is embedded in consuming class library AAR and duplicated in APK
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- android, csharp
調査の方向性
最小構成の net10.0-android クラス ライブラリで問題を再現して dotnet pack を実行し、その後、生成された AAR と nuspec を調べます。_GetLibraryImports、_CategorizeAndroidLibraries、_CreateAar、_CreateAarCache の項目フローを確認します。保持された依存関係が、外側の AAR に重複して含まれることなく 1 つのネイティブ ライブラリを提供し、クラス ライブラリの Java コンパイルを壊さなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Android framework version
net10.0-android
Affected platform version
.NET SDK 10.0.x with the net10.0-android workload; also reproduced with Android workload 37.0.0-preview.6.59
Description
Xamarin.AndroidX.Graphics.Path 1.1.0.1 causes its native libandroidx.graphics.path.so payload to be embedded into every consuming Android class library's generated AAR. When that class library is packed as a NuGet, the NuGet also correctly retains Xamarin.AndroidX.Graphics.Path as a dependency. An application consuming the outer NuGet therefore receives the same native library twice and reports XA4301.
The MSBuild item flow is:
Xamarin.AndroidX.Graphics.Path.targetsaddsandroidx.graphics.graphics-path.aarasAndroidAarLibrary._GetLibraryImportsextracts its native files asAndroidNativeLibrary.- For a class library,
_CategorizeAndroidLibrariescopies everyAndroidNativeLibrarytoEmbeddedNativeLibrary. _CreateAarpasses allEmbeddedNativeLibraryitems toCreateAar, embedding them into the outer library's generated AAR.- NuGet packing includes that generated AAR and retains the package dependency, so an application receives both copies.
The two copies are byte-for-byte identical. This is not specific to Compose, but it is exposed by packing Microsoft.AndroidX.Compose, which depends transitively on Xamarin.AndroidX.Graphics.Path through Xamarin.AndroidX.Compose.UI.Graphics.Android.
A minimal reproduction is an Android class library with:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0-android</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Graphics.Path" Version="1.1.0.1" />
</ItemGroup>
</Project>
Run dotnet pack and inspect the resulting package:
- The generated class-library AAR contains
jni/<abi>/libandroidx.graphics.path.so. - The nuspec retains the
Xamarin.AndroidX.Graphics.Pathdependency.
Consume that package from a net10.0-android application and build an APK. The application sees the native library both through the outer AAR and through Xamarin.AndroidX.Graphics.Path.
Expected behavior: a native asset already supplied by a retained NuGet dependency should not also be embedded in the consuming class library's AAR. This may require package-generation changes, an Android SDK item-metadata mechanism, or limiting runtime AAR inclusion to the final application without breaking class-library Java compilation.
We are working around this in Microsoft.AndroidX.Compose by removing libandroidx.graphics.path.so from EmbeddedNativeLibrary after _CategorizeAndroidLibraries and before _CreateAarCache. The package dependency remains, and the final APK still contains one copy per selected ABI.
Relevant log output
obj/Debug/net10.0-android/lp/203/jl/jni/x86_64/libandroidx.graphics.path.so : warning XA4301: APK already contains the item lib/x86_64/libandroidx.graphics.path.so; ignoring.
obj/Debug/net10.0-android/lp/203/jl/jni/arm64-v8a/libandroidx.graphics.path.so : warning XA4301: APK already contains the item lib/arm64-v8a/libandroidx.graphics.path.so; ignoring.
- 主要言語
- C#
- スター
- 319
- フォーク
- 73
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/android-libraries のほかの issue
-
Stable Updates 20261019対応中かも @jonathanpeppers が今日担当しました。 オープン
dotnet/android-libraries#1565 · リアクション 1 件 · 担当者 2 名 ·
メンテナーはふだん 2 日以内に返信
-
Unfreeze Xamarin.Firebase.Firestore and Xamarin.Protobuf.JavaLite now that Firebase BoM 35.0.0 fixes the Protolite conflict対応中かも @jonathanpeppers が 6 日前に担当しました。 オープン
dotnet/android-libraries#1563 · リアクション 1 件 · 担当者 2 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 20/100
dotnet/android-libraries#1561 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
-
Regression: incorrect nullability annotations in Xamarin.AndroidX.AppCompat 1.8.0対応中かも @jonathanpeppers が 9 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 40/100
dotnet/android-libraries#1558 · リアクション 1 件 · 担当者 2 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
dotnet/android-libraries#1549 ·
メンテナーはふだん 2 日以内に返信
dotnet/android-libraries の issue をすべて見る
似ている issue
-
bug priority: P2
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
[Docs] README/PRIVACY still name AppCenter although v1.5.6.0+ uses the Microsoft Store Services SDKオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Azure/azure-sdk-tools#17317 ·
メンテナーはふだん 1 日以内に返信
-
Test
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 1 日以内に返信