Compose 报错 navigation destination is not a direct child of this NavGraph
compose
compose - Docker Compose是一个用于定义和运行多容器Docker应用程序的工具,通过Compose文件格式简化应用部署过程。
项目地址:https://gitcode.com/gh_mirrors/compose/compose

·
近来学习Compose时在使用Navigation参数传递的时候出现了一个报错,花了一番功夫。
首先因为Navigation参数传递本身就是以URL的形式进行传递的所以我们在一个URL里面套一个URL必定会出现解析 /
错误
Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/article_page/https://juejin.cn/post/7096376474831650823 }
cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0x177a1068) route=main_page}
发现其中系统的
android-app://androidx.navigation
与我们的文章URL重叠所以导致参数解析异常无法定位到此URL结局办法也很简单使用
compose
compose - Docker Compose是一个用于定义和运行多容器Docker应用程序的工具,通过Compose文件格式简化应用部署过程。
项目地址:https://gitcode.com/gh_mirrors/compose/compose
URLEncoder.encode(this, StandardCharsets.UTF_8.toString())
将其加密以下就会将/
即可替换为%
为了方便使用定义以下工具类
import java.net.URLDecoder
import java.net.URLEncoder
import java.nio.charset.StandardCharsets
/**
* When you want to pass the URL in the URL,
* please pay attention to the encoding format,
* otherwise it will cause / be parsed by Navigation as the system directed URL.
* Please use encode to encode the URL to avoid this problem
* create by zyique chou 05/11/2022
*/
fun String.encode() = URLEncoder.encode(this, StandardCharsets.UTF_8.toString()) ?: ""
fun String.decode() = URLDecoder.decode(this, StandardCharsets.UTF_8.toString()) ?: ""
在需要的地方进行调用即可
navController.navigate(ApplicationPages.ARTICLE_PAGE.router + "/${article.link.encode()}")
推荐内容




compose - Docker Compose是一个用于定义和运行多容器Docker应用程序的工具,通过Compose文件格式简化应用部署过程。
最近提交(Master分支:8 个月前 )
5bb46035
Signed-off-by: Anvar Umuraliev <an.umuraliev@gmail.com>
2 天前
f8dae06d
COMPOSE_PROGRESS variable supports 5 values:
- "auto" - detect console capabilities
- "tty" - use terminal capability for advanced rendering
- "plain" - dump raw events to output
- "quiet" - don't display events
- "json" - outputs a machine-readable JSON stream
Signed-off-by: Anvar Umuraliev <an.umuraliev@gmail.com>
2 天前
更多推荐
相关推荐
查看更多
compose

compose - Docker Compose 是一款专门用于定义及运行多容器 Docker 应用的工具,它通过采用 Compose 文件格式,有效简化了应用的部署流程。
compose

分享compose模板,方便新人,老手快速部署docker容器,注释特别多,不懂看注释和最上方的链接,文字量巨大,劝退预警XD,懒得建站建博客,直接拿github当博客lol
Compose

Nice and simple DSL for Espresso Compose UI testing in Kotlin
热门开源项目
活动日历
查看更多
直播时间 2025-04-25 15:00:00


直播时间 2025-04-23 19:00:00

GitTalk:国内首个微服务编排框架Juggle实战解析
直播时间 2025-04-22 18:31:56

字节AI 黑科技!从 Manus Agent 入门 Eino
直播时间 2025-04-09 14:34:18

樱花限定季|G-Star校园行&华中师范大学专场
直播时间 2025-04-07 14:51:20

樱花限定季|G-Star校园行&华中农业大学专场
所有评论(0)