Status Update
Comments
aa...@google.com <aa...@google.com>
rk...@google.com <rk...@google.com> #2
Is this specific to navigation? Or can this be reproduced with another other Composable component?
bo...@google.com <bo...@google.com> #3
It only happens inside of a NavHost. So, yes, it seems to be specific to navigation.
ma...@gmail.com <ma...@gmail.com> #4
This was caused by the fix to BackHandler
lifecycle aware. The problem here is that the NavController
registers its lifecycle and added an observer to the Activity
Lifecycle
in composition while the BackHandler
registers its observer on the Activity
Lifecycle
in a DisposbleEffect
. This means that the NavController
will always get Lifecycle callbacks before the BackHandler
, so the components listening the the NavController
's lifecycle (like the NavBackStackEntry) will always get their Lifecycle callbacks before the BackHandler
as well.
This should be addressed by work coming in 2.7 to integrate the BackHandler
into the NavHost
.
rk...@google.com <rk...@google.com> #5
Branch: androidx-main
commit d2c5efe67531a30fb9f1a129d52beb1e9ece0b29
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed May 31 23:09:54 2023
Integrate BackHandler into NavHost
Instead of NavHost taking over the onBackPressedDispatcher from the
Activity, we should just make it use a BackHandler. This will ensure
that it interacters with the other BackHandlers in Compose correctly.
RelNote: "`NavHost` now correctly intercepts system back calls even
after the Activity has been `STOPPED` and `RESUMED`."
Test: modified tests
Bug: 279118447
Change-Id: Icb6deab996d122487243f0d3d775af8c15fc7c25
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
ma...@gmail.com <ma...@gmail.com> #6
This has been fixed internally and will be available in Navigation 2.7.0-beta01.
rk...@google.com <rk...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.7.0-beta01
ma...@gmail.com <ma...@gmail.com> #8
rk...@google.com <rk...@google.com> #9
I wouldn't say this is fixed. If you add a back-callback in the activity which is lifecycle aware, and then background->foreground the app, the activity back-callback will be put on top of the callback pile. This leads to that any BackHandler in your composable will NOT be triggered.
The best workaround I have for now is to use the non-lifecycle aware function in the activity.
class MainActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// open fragment which hoists the composables
...
if (savedInstanceState == null) {
onBackPressedDispatcher.addCallback(onBackPressedCallback = someBackHandling())
// onBackPressedDispatcher.addCallback(owner = this, onBackPressedCallback = someBackHandling) // not this one
}
}
rk...@google.com <rk...@google.com> #10
ma...@gmail.com <ma...@gmail.com> #11
rk...@google.com <rk...@google.com> #12
Bug Fixes : NavHost in Navigation Compose now correctly intercepts system back calls even after the Activity has been STOPPED and RESUMED.
It works fine for me.
rk...@google.com <rk...@google.com> #13
ma...@gmail.com <ma...@gmail.com> #14
In my case it works fine when the app is first ran, but my custom callback calls navController.popBackStack internally if it can't handle back press on its own. So, when I run the app and click back, everything works, but after I pop up all the Composables from the stack and return to the app, the custom callback is not called anymore.
rk...@google.com <rk...@google.com> #15
Re
Note that you should never, ever be calling navController.popBackStack()
in your own BackHandler
as Navigation must be the only one handling its own back stack with the system back button so that Predictive Back works correctly in the future.
ma...@gmail.com <ma...@gmail.com> #16
rk...@google.com <rk...@google.com> #17
I believe this is still an issue even without using NavHost like mentioned in
ma...@gmail.com <ma...@gmail.com> #18
ko...@google.com <ko...@google.com> #19
Thanks for reporting this, a change is submitted (aosp/3393546) and will be available in the next canary builds of the emulator to correctly give an error for zero device cases. I'll close this one now as the booting issue is resolved with a driver update.
an...@google.com <an...@google.com> #20
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Emulator 35.3.11 Stable
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!
an...@google.com <an...@google.com> #21
Further fixes for this issue are now available in:
- Android Emulator 35.4.5 Canary
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Description
####################################################
Please provide all of the following information, otherwise we may not be able to route your bug report.
####################################################
1. Describe the bug or issue that you're seeing.
Hi, my name is Max, and I’m currently experiencing an issue with my Android Virtual Device (AVD). After creating the AVD, I’m unable to open it. The system keeps displaying a pop-up error stating that the AVD has terminated.
I checked the log file, and it shows the following error:
" 2024-12-04 19:07:57,970 [ 676451] INFO - Emulator: Pixel 9 Pro XL API 30 - [4504:2088:20241204,190757.970:ERROR filesystem_win.cc:130] GetFileAttributes C:\Users\crazy\AppData\Local\Temp\AndroidEmulator\emu-crash-35.2.10.db\attachments\4adcdf86-281b-417e-b896-b530668bbdcf: The system cannot find the file specified. (2) "
When I checked the file location, the folder was empty. Can u help solve about this ? Thank you!
2. Attach log files from Android Studio
2A. In the IDE, select the Help..Collect Logs and Diagnostic Data menu option.
2B. Create a diagnostic report and save it to your local computer.
2C. Attach the report to this bug using the Add attachments button.
3. If you know what they are, write the steps to reproduce:
3A. Unable to open the AVD
3B. Cannot file the attactments file
3C.
In addition to logs, please attach a screenshot or recording that illustrates the problem.
For more information on how to get your bug routed quickly, see
Build: AI-242.23339.11.2421.12700392, 202411230116
AS: Ladybug | 2024.2.1 Patch 3
AI-242.23339.11.2421.12700392, JRE 21.0.3+-12282718-b509.11x64 JetBrains s.r.o., OS Windows 10(amd64) v10.0 , screens 1920x1080 (100%), 1920x1080 (125%)
Android Gradle Plugin: 8.7.3
Gradle: 8.9
Gradle JDK: JetBrains Runtime 21.0.3
NDK: from local.properties: (not specified), latest from SDK: (not found)
CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
Source: send_feedback_icon```