Status Update
Comments
bq...@squareup.com <bq...@squareup.com> #2
This happens when fragments use animation whereby it doesn't wait for animations to complete and moves directly to RESUMED state.
The entry's listener to Fragment state does not get attached because it was attaching only if Fragment was in CREATED / STARTED state.
de...@squareup.com <de...@squareup.com> #3
Branch: androidx-main
commit 16afaea63fc18ca7cc298e6650e0463083ba8ad7
Author: Clara Fok <clarafok@google.com>
Date: Mon Feb 27 17:27:15 2023
Fix FragmentNavigator resume states
Entries previously were not attaching fragment lifecycle observers because it would do so only if Fragment was STARTED or CREATED. But when using animations, Fragments would jump straight to RESUME and no observers would be attached.
Observers are now attached as long as Fragment is atleast STARTED. Since initial entry is not added to backStack, we store its entry to later attach an observer when its fragment is attached.
This CL also lays the foundation for attaching observers upon configuration changes / recreates.
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 269646882
Relnote: "Fixes regression in navigation 2.6.0-alpha06 where NavBackStackEntry is not moved to RESUMED state"
Change-Id: Ib35896636c187da5bd11ea06234a3ea815fdeb68
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
A navigation/navigation-fragment/src/androidTest/res/anim/fade_enter.xml
A navigation/navigation-fragment/src/androidTest/res/anim/fade_exit.xml
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.kt
js...@google.com <js...@google.com>
ri...@google.com <ri...@google.com> #4
This has been fixed internally and will be available in navigation 2.6.0-alpha07
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit c73552953192ba60a879f5e51218f6e157a24beb
Author: Clara Fok <clarafok@google.com>
Date: Tue Feb 28 14:47:30 2023
Add FragmentNavigator test
Ensure initial fragments and their entries are correctly replaced and destroyed when navigate and popping consecutively
Test: ./gradlew navigation:navigation-fragment:cC
Bug: 269646882
Change-Id: I552ddd3d74f20612c4c91336eb4af9e6aa99c146
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/navigation-fragment/src/androidTest/res/navigation/nav_simple.xml
ap...@google.com <ap...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-fragment:2.6.0-alpha07
ap...@google.com <ap...@google.com> #7
NavBackStackEntry is still not triggering RESUMED on androidx.navigation:navigation-fragment:2.6.0-alpha09
in certain cases, where after a locale or uiMode change with
AppCompatDelegate.setApplicationLocales
AppCompatDelegate.setDefaultNightMode
Issue can be reproduced with attaching LifecycleObserver to the currentBackStackEntry of a Home fragment like so:
findNavController().currentBackStackEntry?.lifecycle?.let {
if (it.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
Timber.d(Constants.LOG_INFO, "lifecycle.currentState", "resumed")
} else {
val testLifecycleObserver = object : DefaultLifecycleObserver {
override fun onResume(owner: LifecycleOwner) {
Timber.d(Constants.LOG_INFO, "lifecycle.currentState", "onResumed")
it.removeObserver(this)
}
}
it.addObserver(testLifecycleObserver)
}
}
After performing a config change as mentioned above on a Settings fragment, upon performing a popBackStack/navigateUp to Home fragment, the DefaultLifecycleObserver's onResume will not be triggered. Issue does not occur if a config change is not performed.
ap...@google.com <ap...@google.com> #8
I believe this was actually addressed as part of the Navigation
ap...@google.com <ap...@google.com> #9
Project: r8
Branch: 8.9
Author: Rico Wind <
Link:
Fix index for feature split dex code in legacy resource shrinking
Expand for full commit details
Fix index for feature split dex code in legacy resource shrinking
This would always be zero, causing us to only trace the dex code for the
last feature split entry in legacy mode.
Add regression test for both optimized(already passing) and
legacy(failing without the fix here).
Bug: b/404745556
Change-Id: Ia7f0e149a1c0d0c556f1c8bee7c3968fc0649cce
Files:
- M
src/main/java/com/android/tools/r8/R8.java
- A
src/test/java/com/android/tools/r8/androidresources/ResourceShrinkingWithSeveralFeaturesTest.java
Hash: ee2c4ec5788759681bf8fa85a23a2ecc84132103
Date: Fri Mar 21 13:29:27 2025
ap...@google.com <ap...@google.com> #10
Project: r8
Branch: 8.10
Author: Rico Wind <
Link:
Fix index for feature split dex code in legacy resource shrinking
Expand for full commit details
Fix index for feature split dex code in legacy resource shrinking
This would always be zero, causing us to only trace the dex code for the
last feature split entry in legacy mode.
Add regression test for both optimized(already passing) and
legacy(failing without the fix here).
Bug: b/404745556
Change-Id: Ia7f0e149a1c0d0c556f1c8bee7c3968fc0649cce
Files:
- M
src/main/java/com/android/tools/r8/R8.java
- A
src/test/java/com/android/tools/r8/androidresources/ResourceShrinkingWithSeveralFeaturesTest.java
Hash: 17ba136869037b2c282770e25c49de052d86b099
Date: Fri Mar 21 13:28:47 2025
ri...@google.com <ri...@google.com> #11
updating to r8 version 8.9.35 should solve this for you (or 8.10.21)
bq...@squareup.com <bq...@squareup.com> #12
The fix appears to be working using the newly released tag 8.9.35.
One confusing thing is that the resources are still tagged as reachable=false
in the r8 resources.txt
output. Is that per spec?
@com.squareup.cash.beta.debug.app:id/local_views_local : reachable=false @com.squareup.cash.beta.debug.feature:string/local_views_local : reachable=false
ri...@google.com <ri...@google.com> #13
I added explicit log testing of multi feature case here:
but that does not show any issues.
Is it possible for you to share a compiledumpe (
ap...@google.com <ap...@google.com> #14
Project: r8
Branch: main
Author: Rico Wind <
Link:
Add resource shrinker log testing for multiple features
Expand for full commit details
Add resource shrinker log testing for multiple features
Add utility class for testing the log output.
This does not show any issues, but based on b/404745556 we might have
issues here in more complicated cases.
Bug: b/404745556
Change-Id: I883629a33ccf7aa649bae1c8fdbe2688547f3456
Files:
- A
src/test/java/com/android/tools/r8/androidresources/DebugConsumerUtils.java
- M
src/test/java/com/android/tools/r8/androidresources/ResourceShrinkerLoggingTest.java
- M
src/test/java/com/android/tools/r8/androidresources/ResourceShrinkingWithSeveralFeaturesTest.java
Hash: b7e84e629971075d381f5b609cc6bd907c9a062e
Date: Tue Mar 25 09:34:56 2025
er...@gmail.com <er...@gmail.com> #15
Ok, I tested again this morning with 8.9.35
on both our app and on the attached repo and the fix is working correctly. Very sorry for the false alarm, I made a mistake in my initial testing which led us to believe there might be another issue since the resources were still marked as unreachable but everything is working as expected now.
Thanks again for the quick fix. I saw AGP 8.9.1
was just release yesterday, would this fix qualify for a 8.9.2
release?
ri...@google.com <ri...@google.com> #16
re #15 I have already made a patch for AGP 8.9, so if a 8.9.2 is cut it should hopefully make that.
an...@google.com <an...@google.com> #17
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Meerkat Feature Drop | 2024.3.2 RC 1
- Android Gradle Plugin 8.10.0-rc01
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
te...@gmail.com <te...@gmail.com> #18
ck...@linkedin.com <ck...@linkedin.com> #19
We are also hitting this exception in our dynamic features. Would be great if there was an 8.9.2 release, in case there are other changes/issues with 8.10 we need to account for.
sg...@google.com <sg...@google.com> #20
As mentioned in
ri...@google.com <ri...@google.com> #21
re #19
Let me also just mention that you can set android.r8.integratedResourceShrinking false
in your settings until you can upgrade to either 8.9.2 or 8.10 stable
This should not have any effect on the output size (it should give you the same) - this flag will eventually be removed though
Description
After bumping Android Gradle plugin to 8.9, all resources from one dynamic feature were tagged as
not reachable and ended up being stripped out from our final apk. This only happens if `shrinkResources`
is set to `true`. `shrinkResources` to false with `minifyEnabled` to true didn't have problems. We
tried with the following versions of R8 and the problem persisted: r8-8.9.27 (agp8.9), r8-8.9,
r8-8.10.0, r8-8.10.13-dev.
We have found a turnaround by adding explicit dependencies to the holding app to the modules whose resources were needed.
Let me know if you need more info.