I'm trying to use this lib in my project but I cannot get started.
I want to use the kotlin-extensions but it does not compile - showing the following error:
Error:Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.xwray.groupie.kotlinandroidextensions.ViewHolder, unresolved supertypes: kotlinx.android.extensions.LayoutContainer
I've created a demo-project with each step to reproduce in one commit (just 4):
https://github.com/hardysim/groupie-demo
There are multiple confusing parts in the README.md here when trying to get started:
implementation 'com.xwray:groupie-kotlin-android-extensions:2.0.0-beta1'kotlinx.android.synthetic.main [...]How can I set this lib up to work with kotlin (and the nice extensions for the view)?
Looks like it works just fine when adding the following to the app's build.gradle:
androidExtensions {
experimental = true
}
I've updated my demo-project with it and it seems to work now (https://github.com/hardysim/groupie-demo/commit/8ae9d7ae9182cfa6d2616689d54f4c73ae38184e).
With this, it really looks like you do not need to include the stuff for the app's build.gradle mentioned here https://github.com/lisawray/groupie#kotlin but you need to do the following instead:
implementation 'com.xwray:groupie-kotlin-android-extensions:2.0.0-beta1'experimental-flag I mentioned aboveTo sum this up:
README.md for others stumbling over this?experimental-flag do? Is it safe to keep it?Hey @hardysim ! Yes, I've just come on to make a stable 2.0 build and I will update the README.
You're actually using a build I published (beta1) but didn't have time to update the docs. You may notice they still point to alpha1 for this reason because I didn't want anyone to get confused as you had. I'm really glad you figured it out.
The experimental flag enables layout caching using Kotlin Android extensions in classes which are not fragments or activities, using the LayoutContainer class. This is very important for RecyclerView and it's a distinction i missed when I first added Kotlin support. It's possible it's in the main Kotlin project by now as they are moving so fast -- I'm about to check!
Done! In the latest (Kotlin 1.2.10) you still need the experimental flag. I updated the README. Happy New Year :)
Most helpful comment
Done! In the latest (Kotlin 1.2.10) you still need the experimental flag. I updated the README. Happy New Year :)