fragmentviewbindingdelegate-kt icon indicating copy to clipboard operation
fragmentviewbindingdelegate-kt copied to clipboard

Not working in a library project

Open kypeli opened this issue 4 years ago • 5 comments

Thank you for the clean approach and the library!

However, if I incorporate it into another library project that is published or consumed as an AAR library, then the code will crash. Please see https://stackoverflow.com/questions/59067743/what-is-this-error-and-why-this-doesnt-happen-when-i-dont-use-library-like-a-c

So please implement all DefaultLifecycleObserver lifecycle methods with empty bodies in both places in the delegate.

kypeli avatar Feb 15 '21 14:02 kypeli

Hey!

Isn't the issue merely that the library that is trying to use this is not using:


    compileOptions {
        this.sourceCompatibility(JavaVersion.VERSION_1_8)
        this.targetCompatibility(JavaVersion.VERSION_1_8)
    }
    
    kotlinOptions {
        jvmTarget = "1.8"
    }

?

Then again, I always figured default methods in desugaring could be shady, so if that doesn't work, I'll add the empty method bodies.

Zhuinden avatar Feb 17 '21 16:02 Zhuinden

Hi! Thank you for the comment! Hmm - now thinking of it, it very well could be the issue you mention; I did check that the main project had those options enabled, but I am not sure if the library project had :( So could explain it. It was such a weird issue that I didn't think of this solution.

kypeli avatar Feb 17 '21 19:02 kypeli

I ran into the same issue with an android library module using this library ... :(

ChristopherME avatar May 04 '21 22:05 ChristopherME

You have enabled viewBinding and added

    compileOptions {
        sourceCompatibility(JavaVersion.VERSION_1_8)
        targetCompatibility(JavaVersion.VERSION_1_8)
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

right?

Zhuinden avatar May 04 '21 23:05 Zhuinden

yes I did... :/

ChristopherME avatar May 05 '21 01:05 ChristopherME