Reputation: 805
I am practing how to using SafeArgs and some other kotlin tools.
Even after adding the SafeArgs
plugin and classpath I still get an error saying..
Cannot access class 'com.example.testingtaskmanager.ui.updatefragment.UpdateFragmentArgs'. Check your module classpath for missing or conflicting dependencies
Here's the added SafeArgs
plugin:
id 'androidx.navigation.safeargs.kotlin'
Here's the added SafeArgs
classpath:
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
I have even tried the other SafeArgs
Plugin, it still gave the same result.
Here's the other safeargs I tries to use:
id "androidx.navigation.safeargs"
For clarity, here's a photo of the error;
EDIT;
more of the plugin from build.gradle App/ Module level
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
//
// id "androidx.navigation.safeargs"
id 'androidx.navigation.safeargs.kotlin'
id 'kotlin-parcelize'
}
more of the plugin from build.gradle Project Level
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
//
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Upvotes: 4
Views: 6970
Reputation: 78
When i working on project, i faced same error.
I used dataBinding
and Then the error come same above.
I solved this issue via renaming parent folder name starting with lowercase and Only ViewModel
Name start with Capital Name .
In my project, i faced this issue due to below
com.example.example.ui.UserModule.ViewModel.SettingViewModel
to
com.example.example.ui.userModule.viewModel.SettingViewModel
Upvotes: 1
Reputation: 564
if anyone still has the same problem it's easy to fix it just add this to your build.gradl
android {
.
.
.
buildFeatures{
dataBinding true
viewBinding true
}
sourceSets {
main {
kotlin {
srcDirs += 'build/generated/source/navigation-args'
}
}
}
}
Upvotes: 0