Hello there after adding dependency of paging
val paging_version = "3.1.0"
implementation("androidx.paging:paging-runtime:$paging_version")
I'm getting this error
Could not set unknown property 'paging_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
Note: I have switched my project from java to kotlin ( because there is some issue the entire project cant be converted so I convert every java file one by one)
CodePudding user response:
I have added it like this and it works:
implementation 'androidx.paging:paging-runtime-ktx:3.1.0"'
CodePudding user response:
Use this :
def paging_version = "3.1.0"
implementation "androidx.paging:paging-runtime:$paging_version"
CodePudding user response:
There's 2 different kinds of migrating to kotlin for android projects.
What you did is migrate your code from java to kotlin. This is what people usually mean when they want to migrate their project to kotlin.
This by itself doesn't change the gradle file to kotlin. The code you tried is applying kotlin to the gradle file. It is possible to change to kotlin (instead of groovy, which you probably have now) but that's a different process.
The groovy equivalent of
val paging_version = "3.1.0"
implementation("androidx.paging:paging-runtime:$paging_version")
would be
def paging_version = "3.1.0"
implementation "androidx.paging:paging-runtime:${paging_version}"