APK doesn't include *.version files in metadata

Open
#243 3 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, java
Domain
build-system

Research direction

Reproduce the issue with the rules_kotlin Jetpack Compose example, comparing the APK and deploy JAR using zipinfo. Trace the Android APK packaging path that filters META-INF/.version files; done means the relevant androidx.compose..version files are present in the final APK and Layout Inspector can recognize Compose components.

Written by the indexing model from the issue text.

Description

Android Studio's Layout Inspector has specific support for Jetpack Compose components, including recompositions. However, this requires certain files to be present in the final APK:

Note: If you're not seeing Compose components in layout inspector, make sure you are not removing META-INF/androidx.compose.*.version files from the APK. These are required for layout inspector to work.

These show up in the deploy jar, but get filtered out of the APK. When building rules_kotlin's Compose example:

$ zipinfo bazel-bin/app/compose_example_app.apk | grep META-INF
-rw----     2.0 fat       52 b- stor 10-Jan-01 00:00 META-INF/services/kotlinx.coroutines.internal.MainDispatcherFactory
-rw----     2.0 fat       54 b- stor 10-Jan-01 00:00 META-INF/services/kotlinx.coroutines.CoroutineExceptionHandler
-rw----     2.0 fat   116511 b- defN 10-Jan-01 00:00 META-INF/CERT.SF
-rw----     2.0 fat     1211 b- defN 10-Jan-01 00:00 META-INF/CERT.RSA
-rw----     2.0 fat   116403 b- defN 10-Jan-01 00:00 META-INF/MANIFEST.MF

$ zipinfo bazel-bin/app/compose_example_app_deploy.jar | egrep 'META-INF/.*\.version'
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.activity_activity-compose.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.activity_activity-ktx.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.activity_activity.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.core_core.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.annotation_annotation-experimental.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-runtime.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.arch.core_core-runtime.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.versionedparcelable_versionedparcelable.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-viewmodel-savedstate.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-livedata-core.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-viewmodel.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.savedstate_savedstate.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.tracing_tracing.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.core_core-ktx.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-runtime-ktx.version
-rw----     2.0 fat        5 b- stor 10-Jan-01 00:00 META-INF/kotlinx_coroutines_android.version
-rw----     2.0 fat        5 b- stor 10-Jan-01 00:00 META-INF/kotlinx_coroutines_core.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-viewmodel-ktx.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.savedstate_savedstate-ktx.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.runtime_runtime-saveable.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.runtime_runtime.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.autofill_autofill.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-geometry.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-util.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-graphics.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-unit.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-text.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.customview_customview-poolingcontainer.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.profileinstaller_profileinstaller.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.startup_startup-runtime.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.appcompat_appcompat.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.appcompat_appcompat-resources.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.vectordrawable_vectordrawable-animated.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.interpolator_interpolator.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.vectordrawable_vectordrawable.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.cursoradapter_cursoradapter.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.drawerlayout_drawerlayout.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.customview_customview.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.emoji2_emoji2-views-helper.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.emoji2_emoji2.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-process.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.fragment_fragment.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.loader_loader.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.lifecycle_lifecycle-livedata.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.viewpager_viewpager.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.material_material.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.animation_animation-core.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.animation_animation.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.foundation_foundation-layout.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.foundation_foundation.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.material_material-icons-core.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.material_material-ripple.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-tooling.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-tooling-data.version
-rw----     1.0 fat        6 b- stor 10-Jan-01 00:00 META-INF/androidx.compose.ui_ui-tooling-preview.version
Dominant language
Java
Stars
205
Forks
113
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazelbuild/rules_android

All issues in bazelbuild/rules_android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.