So after using the code examples from the Android development website when i tried running it in my Code i got an error or warning saying Unresolved reference can this be ignored or is there a way to fix it
My Code is
Sorry if this is reposted i am moving this to support rather then android as it would be more appropriate.
fun main() {
private val vc: ViewConfiguration = ViewConfiguration.get(context)
private val mSlop: Int = vc.scaledTouchSlop
private val mMinFlingVelocity: Int = vc.scaledMinimumFlingVelocity
private val mMaxFlingVelocity: Int = vc.scaledMaximumFlingVelocity
}
“Unresolved reference” is the compiler telling you that you’re using a name it doesn’t know about–kinda like me asking you to tell your “foo number” but you have no idea what a foo number is (it’s jibberish for the example).
The compiler should include which reference you’re using that it doesn’t understand.
For example, try pressing the run button here:
fun main() {
println(foo) // The compiler has no idea "foo" means
}
The fix really depends on a lot of factors. Maybe the reference is miss spelled, maybe it’s not imported, or maybe it’s not included as a dependency. Alternatively, it could be private or out of scope from where it’s being referenced like this:
fun doSomething() {
val foo = 5
println(foo) // This works since foo is available in the function's scope
}
fun main() {
println(foo) // "foo" is not defined in this scope
}
If you want, you can post more of the error you’re getting–it should tell you more about what the issue is and where.
I’d also recommend going through any basic Kotlin tutorials if you find these are new concepts. They usually dish out the information in a much easier-to-follow way if you’re a beginner.