Android导航组件未解决的参考

彼得·科瓦奇

我刚刚将平台从Windows更改为Mac,当我尝试构建我的应用程序时,出现以下消息:

Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun `Activity;`.findNavController(viewId: Int): `NavController;` defined in androidx.navigation
public fun `View;`.findNavController(): `NavController;` defined in androidx.navigation

错误在那一行:

bSettingsLogout.findNavController().navigate(R.id.authenticationActivity)

在Windows上,我使用了较早的3.3 canary版本,但在开发人员站点上,导航组件没有任何变化。

我不确定是Mac还是Android Studio Canary 6错误。

任何帮助,将不胜感激!

用户名

有2种实现findNavController
public static NavController findNavController (View view)和,
public static NavController findNavController (Activity activity, int viewId)
但是您使用

findNavController()  

您缺少所需的参数

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章