Skip to content

Android AAR drops every stdlib directory starting with _ (AGP ignoreAssetsPattern) #546

Done

Description

@b-re-w

The python-multiplatform-android AAR ships no stdlib directory whose name starts with _ (reported by torchnative against 3.15.0-alpha03, built from develop d2df489).

copyAndroidPythonAssets stages them (build/android/assets/arm64-v8a/lib/python3.15t/zipfile/_path exists), but the AAR has none: zipfile/_path, _pyrepl, __phello__, compression/_common, ensurepip/_bundled and the like are missing. AGP's default ignoreAssetsPattern contains <dir>_*, which drops every asset directory starting with _ when the library's assets are merged.

Effect: importlib.metadata needs zipfile._path, so an app importing it fails on the device with "No module named 'zipfile._path'". An app-side pattern override cannot restore files the AAR never had (the app side is toolchain #166).

Fix: set androidResources.ignoreAssetsPattern in python-multiplatform/build.gradle.kts to AGP's default without <dir>_*.

Completion criterion: unzip -l <aar> | grep zipfile/_path lists the directory, and a new instrumented test (AndroidStdlibAssetsTest) that imports zipfile._path and importlib.metadata on the device passes in CI (it fails on the current AAR).

Activity

  1. added a commit that references this issue on Nov 27, 2026
  2. b-re-w commented on Nov 27, 2026

    @b-re-w
    MemberAuthor

    Landed in develop via #547.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions