question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EpoxyAttribute generate problem for Kotlin

See original GitHub issue

I try to apply EpoxyAttribute to field in Kotlin, like below:

@EpoxyModelClass(layout = R.layout.model_epoxy)
abstract class TestEpoxyModel(@EpoxyAttribute @ColorInt var color: Int) : EpoxyModel<View>() {
	override fun bind(view: View?) {
		view?.setBackgroundColor(color)
	}
}

And got error on compile annotation, like below:

com.airbnb.epoxy.EpoxyProcessorException: EpoxyAttribute annotations must not be on private or static fields. (class: TestEpoxyModel, field: color)
e: Some error(s) occurred while processing annotations. Please see the error messages above.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
zaihuishoucommented, Jul 22, 2017

@elihart i solved it. change annotationProcessor 'com.airbnb.android:epoxy-processor:2.2.0' to kapt 'com.airbnb.android:epoxy-processor:2.2.0'

1reaction
geralt-encorecommented, Feb 23, 2017

@minibugdev sorry, I wasn’t clear enough. It wasn’t a solution for you case - it was a proposal to @elihart how it could be possibly solved in a more kotlin way. @JvmField works as a temporary workaround tho.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Epoxy does not generate model class? - Stack Overflow
I want to use Epoxy for my recyclerView with kotlin, but Epoxy Model does not generate PostModel_() class, what wrong with it?
Read more >
How do you set OnClickListenrs in your AirBNB Epoxy Models ...
Holder>() { // Declare your model properties like this @EpoxyAttribute @StringRes var text = 0 @EpoxyAttribute(EpoxyAttribute.Option.
Read more >
Kotlin Language Documentation 1.7.21
Create a project. Create an application. Run the application. What's next? Comparison to Java. Some Java issues addressed in Kotlin.
Read more >
RecyclerViews made easy with Epoxy | by Sasikanth - Medium
addTo(EpoxyController) . But since we are using Kotlin we can use the generated extension functions to build the models. They will automatically ...
Read more >
Epoxy - Models and Extensions - Part2 - - Seyed Jafari Blog
since we are using Kotlin one more thing Epoxy code-gen does for us is generating extension function for each of our models. using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found