报错信息
class xxxDirections is not abstract and does not implement abstract member public abstract val actionId: Int defined in androidx.navigation.NavDirections
在百度上查找答案无果后换成Bing,成功在第一条结果找到解决方案
解决方案参考? 网址:
Android studio build error in navigation component, action is not abstract and does not implement abstract member actionID - Stack Overflowhttps://stackoverflow.com/questions/67609911/android-studio-build-error-in-navigation-component-action-is-not-abstract-and-d
我的实践:
????????在使用safeargs的2.3.5和2.4.0-alpha01传递参数时,不知从何而来,构建正在崩溃与导航组件相关的一个奇怪的错误,即使它以前工作过,错误是在生成的类HomeFragmentDirections,根据评论区的解决方案更新safeArg插件到2.4.0-alpha04,成功摆脱错误消息。
参考:
[build.gradle]
buildscript {
...
dependencies {
...
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0-alpha04'
}
[app/build.gradle]
dependencies {
...
implementation 'androidx.fragment:fragment-ktx:1.4.0-alpha04'
api 'androidx.navigation:navigation-fragment-ktx:2.4.0-alpha04'
api 'androidx.navigation:navigation-ui-ktx:2.4.0-alpha04'
}
|