airbnb / paris

Define and apply styles to Android views programmatically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors building library project with Butterknife + ksp

ottne opened this issue · comments

commented

Hi all,

I've been getting errors trying to build a library project using Paris together with Butterknife and KSP. Error messages are as follows:

[ksp] Incorrectly typed @Attr value parameter. (This usually happens when an R value doesn't exist.) java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.lang.reflect.InvocationHandler.invoke(Object, java.lang.reflect.Method, Object[])" is null [element=setInsetLeft Setter in de.danotter.parisproxies.MaterialButtonProxy]

The declarations are like these:

@Styleable("App_MaterialButton")
class MaterialButtonProxy(private val button: MaterialButton) :
    BaseProxy<MaterialButtonProxy, MaterialButton>(button) {

    @set:Attr(R2.styleable.App_MaterialButton_android_insetLeft)
    @setparam:Px
    var insetLeft: Int = 0
    [...]
}

I've uploaded a minimal project highlighting the issue:
https://github.com/ottne/paris-test

It seems like the processor can't find the generated R2 classes, although they're definitely in the build folder with the right package name. Unfortunately I have little experience debugging processor issues, so this is as much insight as I can provide at the moment.

EDIT: I forgot to mention that the same project compiles if you replace ksp with kapt.

Hi @ottne Have you managed to fix this somehow?

commented

@Jparrgam, sadly, so far no. What I did is to create a separate module in which kapt is allowed to run in order to confine the stub generation as much as possible.