Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
lp...@google.com <lp...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
il...@google.com <il...@google.com> #4
Ah, I see that compose/runtime/runtime-lint
:compose:lint:common
I'm not sure if there's any issue with depending on that from an activity-compose-lint
(which is where this check would need to go), but I think we can work with that.
lp...@google.com <lp...@google.com> #5
Yes, it's a special dependency (bundleInside) that's bundled with the lint check jar since lint checks can't have normal dependencies, so there's no problem with dependencies / groups / versions.
mv...@google.com <mv...@google.com> #6
Yes Ian, I meant calling launch
. Thank you!
wr...@gmail.com <wr...@gmail.com> #7
Business development
wr...@gmail.com <wr...@gmail.com> #8
version (in a git tree: git describe --tags --match N):0093096600181
wr...@gmail.com <wr...@gmail.com> #9
version (in a git tree: git describe --tags --match N): Rajpoot
ap...@google.com <ap...@google.com> #10
Project: platform/frameworks/support
Branch: androidx-main
commit 7c2bbe38807c834b21a3766cfcca141765bd19a9
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Aug 25 13:00:43 2021
Add lint rule to prevent call launch in composition
You should never call launch() in composition when using compose.
Test: added test
Bug: 191347220
Change-Id: I54f9f3e7ee56434b7d9a35f0a509d86b541b2b70
A activity/activity-compose-lint/build.gradle
A activity/activity-compose-lint/src/main/java/androidx/activity/compose/lint/ActivityComposeIssueRegistry.kt
A activity/activity-compose-lint/src/main/java/androidx/activity/compose/lint/ActivityResultLaunchDetector.kt
A activity/activity-compose-lint/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry
A activity/activity-compose-lint/src/test/java/androidx/activity/compose/lint/ActivityResultLaunchDetectorTest.kt
A activity/activity-compose-lint/src/test/java/androidx/activity/compose/lint/ApiLintVersionsTest.kt
M activity/activity-compose/build.gradle
M settings.gradle
https://android-review.googlesource.com/1809166
Branch: androidx-main
commit 7c2bbe38807c834b21a3766cfcca141765bd19a9
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Aug 25 13:00:43 2021
Add lint rule to prevent call launch in composition
You should never call launch() in composition when using compose.
Test: added test
Bug: 191347220
Change-Id: I54f9f3e7ee56434b7d9a35f0a509d86b541b2b70
A activity/activity-compose-lint/build.gradle
A activity/activity-compose-lint/src/main/java/androidx/activity/compose/lint/ActivityComposeIssueRegistry.kt
A activity/activity-compose-lint/src/main/java/androidx/activity/compose/lint/ActivityResultLaunchDetector.kt
A activity/activity-compose-lint/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry
A activity/activity-compose-lint/src/test/java/androidx/activity/compose/lint/ActivityResultLaunchDetectorTest.kt
A activity/activity-compose-lint/src/test/java/androidx/activity/compose/lint/ApiLintVersionsTest.kt
M activity/activity-compose/build.gradle
M settings.gradle
jb...@google.com <jb...@google.com> #11
This has been added internally and will be released as part of Activity 1.4.0-alpha02
.
Description
The
rememberLauncherForActivityResult
API inandroidx.activity:activity-compose
should warn when the developer attempts to call it in a composable scope.At the moment, doing this throws a runtime exception but it'd be nice to warn earlier and not having to wait for the app to run.