gpt4 book ai didi

Android studio在导航组件中构建错误, Action 不是抽象的并且没有实现抽象成员actionID

转载 作者:行者123 更新时间:2023-12-04 04:25:37 24 4
gpt4 key购买 nike

不知从何而来,构建崩溃并出现与导航组件相关的奇怪错误,即使它以前可以工作,错误出现在生成的类中,在我的情况下为 NativeLanguageSelectionFragmentDirections这是错误

e: C:\Users\David\StudioProjects\android\app\build\generated\source\navigation-args\debug\com\linguistic\linguistic\framework\presentation\loginscreens\ui\main\NativeLanguageSelectionFragmentDirections.kt: (10, 16): Class 'GoToSelectLearningLangAction' is not abstract and does not implement abstract member public abstract val actionId: Int defined in androidx.navigation.NavDirections
e: C:\Users\David\StudioProjects\android\app\build\generated\source\navigation-args\debug\com\linguistic\linguistic\framework\presentation\loginscreens\ui\main\NativeLanguageSelectionFragmentDirections.kt: (13, 12): 'getActionId' overrides nothing
e: C:\Users\David\StudioProjects\android\app\build\generated\source\navigation-args\debug\com\linguistic\linguistic\framework\presentation\loginscreens\ui\main\NativeLanguageSelectionFragmentDirections.kt: (15, 12): 'getArguments' overrides nothing
这是导航图的代码
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/first_login_graph.xml"
app:startDestination="@id/nativeLanguageSelectionFragment">

<fragment
android:id="@+id/nativeLanguageSelectionFragment"
android:name="com.linguistic.linguistic.framework.presentation.loginscreens.ui.main.NativeLanguageSelectionFragment"
android:label="NativeLanguageSelectionFragment"
tools:layout="@layout/language_selection_fragment">
<action
android:id="@+id/goToSelectLearningLangAction"
app:destination="@id/learningLanguageSelectionFragment"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right"
app:popUpTo="@id/nativeLanguageSelectionFragment"
app:popUpToInclusive="true" />
</fragment>
<fragment
android:id="@+id/learningLanguageSelectionFragment"
android:name="com.linguistic.linguistic.framework.presentation.loginscreens.ui.main.LearningLanguageSelectionFragment"
android:label="LearningLanguageSelectionFragment"
tools:layout="@layout/language_selection_fragment">
<argument
android:name="nativeLanguageID"
app:argType="string"
app:nullable="true" />
<action
android:id="@+id/action_learningLanguageSelectionFragment_to_welcomeFragment"
app:destination="@id/welcomeFragment"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right"
app:popUpTo="@id/learningLanguageSelectionFragment"
app:popUpToInclusive="true" />
</fragment>
<fragment
android:id="@+id/welcomeFragment"
android:name="com.linguistic.linguistic.framework.presentation.loginscreens.ui.main.WelcomeFragment"
android:label="fragment_welcome"
tools:layout="@layout/fragment_welcome" />
</navigation>
我在用
 "androidx.navigation:navigation-fragment-ktx:2.3.5"
"androidx.navigation:navigation-ui-ktx:2.3.5"

最佳答案

我也有这个问题。
直到他们发布修复程序。
请试试这个:

plugins {
id("androidx.navigation.safeargs")
}
代替
plugins {
id("androidx.navigation.safeargs.kotlin")
}

关于Android studio在导航组件中构建错误, Action 不是抽象的并且没有实现抽象成员actionID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67609911/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com