Android 导航组件未解析的引用
Android Navigation Component unresolved reference
我刚刚将平台从 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 金丝雀版本,但在开发者网站上导航组件没有任何变化。
我不确定它是 mac 还是 Android Studio Canary 6 错误。
如有任何帮助,我们将不胜感激!
findNavController
有 2 种实现方式:
public static NavController findNavController (View view)
和
public static NavController findNavController (Activity activity, int viewId)
但是你使用
findNavController()
您缺少所需的参数
是的,这似乎是最新版本 Android Studio Canary 的一个错误。至少,回滚到以前的 Canary 版本为我解决了这个问题
我是 运行 Windows,所以这不是 Mac 问题
我刚刚将平台从 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 金丝雀版本,但在开发者网站上导航组件没有任何变化。
我不确定它是 mac 还是 Android Studio Canary 6 错误。
如有任何帮助,我们将不胜感激!
findNavController
有 2 种实现方式:
public static NavController findNavController (View view)
和
public static NavController findNavController (Activity activity, int viewId)
但是你使用
findNavController()
您缺少所需的参数
是的,这似乎是最新版本 Android Studio Canary 的一个错误。至少,回滚到以前的 Canary 版本为我解决了这个问题
我是 运行 Windows,所以这不是 Mac 问题