Status Update
Comments
bi...@google.com <bi...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Clara Fok <
Link:
Fix ActivityNavigator not encoding with NavType
Expand for full commit details
Fix ActivityNavigator not encoding with NavType
When navigating with dynamic arugments, ActivityNavigator should first try to encode the argument value with the associated NavType. If NavType is not present (XML file has dataPattern but not arguments added) then we should fallback to existing behavior of just encoding the arg value with toString().
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 383616432
Relnote: "When navigating to activity with dataPattern, ActivityNavigator will now try to encode the arg value with the argument's NavType."
Change-Id: I163763c46090ae9b4c8ee75d52142986e507c0c3
Files:
- M
navigation/navigation-runtime/src/androidTest/java/androidx/navigation/ActivityNavigatorTest.kt
- M
navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.kt
Hash: ad1ddb7df46854191c753e309e72216fae9309de
Date: Mon Jan 06 15:51:40 2025
bi...@google.com <bi...@google.com>
bi...@google.com <bi...@google.com> #3
Fixed internally and available in navigation 2.9.0-alpha05
bi...@google.com <bi...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-runtime:2.9.0-alpha05
androidx.navigation:navigation-runtime:2.8.6
ga...@google.com <ga...@google.com> #5
setIrUsedInAnalytics
should be invoked only for KotlinCompile
tasks, and the Kotlin IDE plugin i.e. prepareKotlinBuildScriptModel
for execution. Do you know how we end up triggering setIrUsedInAnalytics
in a way that causes this warning to be logged?
bi...@google.com <bi...@google.com> #6
This is the debug log for a sync with kotlin plugin applied. Without kotlin plugin applied, it works fine.
> Configure project :app
getting into the create analytics service function at time 1686770052371
getting into recordIrBackendForAnalytics at time 1686770054291
projects has been evaluated and analytics service is being created at time 1686770054355
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
Capturing memory snapshot at: /usr/local/google/home/bingran/Desktop/sync-result/1686770054853-ANDROID_STARTED.hprof
Done in 1450
configuring compileDebugKotlin 1686770056745
throwing warning/error from kgpUtils at time 1686770056745
configuring compileDebugAndroidTestKotlin 1686770057072
throwing warning/error from kgpUtils at time 1686770057072
configuring compileDebugUnitTestKotlin 1686770057082
throwing warning/error from kgpUtils at time 1686770057083
configuring compileReleaseKotlin 1686770058060
throwing warning/error from kgpUtils at time 1686770058061
configuring compileReleaseUnitTestKotlin 1686770058075
throwing warning/error from kgpUtils at time 1686770058075
Capturing memory snapshot at: /usr/local/google/home/bingran/Desktop/sync-result/1686770059542-ANDROID_FINISHED.hprof
Done in 1824
BUILD SUCCESSFUL in 11s
I think we configure kotlin tasks before task graph is ready and after project gets evaluated. See configureKotlinCompileForProject
This is fine for running tasks because the analytics service is created after task graph is computed. However, it is a problem for sync because the analytics services is created right after projects get evaluated, which is likely to happen before configuring kotlin task.
Do you know why we need to configure kotlin compile task in a sync?
ga...@google.com <ga...@google.com> #7
Can you print a full stacktrace where you log configuring compileDebugKotlin
as that should point to the invoker? I think this gets configured from the model builders as we need to resolve some task properties in order to set up the IDE. As you've correctly pointed out, this is fine during build as all tasks will be configured before task execution starts (except for in configure-on-demand case).
bi...@google.com <bi...@google.com> #8
Here is the stack trace(I hides the gradle calls) Does this make sense to you? It is triggered because of kotlinTask.get()
from
com.android.build.gradle.internal.utils.KgpUtils$recordIrBackendForAnalytics$1.invoke(kgpUtils.kt:146)
com.android.build.gradle.internal.utils.KgpUtils$recordIrBackendForAnalytics$1.invoke(kgpUtils.kt:144)
com.android.build.gradle.internal.utils.KgpUtils$configureKotlinCompileForProject$1.execute(kgpUtils.kt:134)
com.android.build.gradle.internal.utils.KgpUtils$configureKotlinCompileForProject$1.execute(kgpUtils.kt:132)
......
org.jetbrains.kotlin.gradle.plugin.AndroidProjectHandler$wireKotlinTasks$preJavaKotlinOutput$1.call(AndroidProjectHandler.kt:288)
org.jetbrains.kotlin.gradle.plugin.AndroidProjectHandler$wireKotlinTasks$preJavaKotlinOutput$1.call(AndroidProjectHandler.kt:286)
.....
com.android.build.gradle.internal.ide.v2.ModelBuilder.createAndroidArtifact(ModelBuilder.kt:711)
com.android.build.gradle.internal.ide.v2.ModelBuilder.createVariant(ModelBuilder.kt:669)
com.android.build.gradle.internal.ide.v2.ModelBuilder.buildAndroidProjectModel(ModelBuilder.kt:386)
com.android.build.gradle.internal.ide.v2.ModelBuilder.buildAll(ModelBuilder.kt:155)
..........
ga...@google.com <ga...@google.com> #9
Ok, that confirms the root cause. In Gradle 8.0 or 8.1, there were some changes to avoid configuring tasks unnecessarily, and I think we are just seeing configuration postponed to model building phase -> so we trigger this warning.
I think we should silence the warning in production and we should reevaluate how we use this build service as there were a couple of issues related to it recently.
bi...@google.com <bi...@google.com> #10
I think we should silence the warning in production and we should reevaluate how we use this build service as there were a couple of issues related to it recently.
Sounds good to me, working on a CL
bi...@google.com <bi...@google.com>
ga...@google.com <ga...@google.com> #11
Do we already have a tracking bug to re-evaluate how we collect stats? ATM not showing warnings is the right thing from user POV, but we should make explicit choices how to handle this.
bi...@google.com <bi...@google.com> #12
Filed a new ticket
hu...@google.com <hu...@google.com> #13
Thanks Bingran, but I just wanted to note that this is a very basic project (New Project template > Empty Activity). That means most projects will start hitting this code path (or were hitting it before without us knowing it --
Collecting correct data is crucial because it's the foundation of everything else. And we'll never know about these issues unless we throw an error/warning.
I don't know the actual consequence of hitting that code path (it may turn out to be trivial), but thought I should point that out so you can evaluate the priority of this issue.
Description
Affected Version
AGP 8.2.0-alpha06, 8.2.0-alpha07 (does not happen on AGP 8.2.0-alpha05)
Steps to Reproduce
This warning was introduced in Issue 270731522 , but it shouldn't show up on this basic project.
@Bingran: Could you take a look?