androidbroadcast / ViewBindingPropertyDelegate

Make work with Android View Binding simpler
https://proandroiddev.com/make-android-view-binding-great-with-kotlin-b71dd9c87719
Apache License 2.0
1.42k stars 102 forks source link

Execution failed for task ':app:minifyReleaseWithR8' #36

Closed abdulatif1707 closed 3 years ago

abdulatif1707 commented 3 years ago

I am getting error while building apk for release. I am using this version:

implementation("com.kirich1409.viewbindingpropertydelegate:viewbindingpropertydelegate:1.4.1")
implementation("com.kirich1409.viewbindingpropertydelegate:vbpd-noreflection:1.4.1")

The error:

Default interface methods are only supported starting with Android N (--min-api 24): Landroidx/lifecycle/DefaultLifecycleObserver;onCreate(Landroidx/lifecycle/LifecycleOwner;)V
Execution failed for task ':app:minifyReleaseWithR8'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: Landroidx/lifecycle/DefaultLifecycleObserver;onCreate(Landroidx/lifecycle/LifecycleOwner;)V

I have checked in library and I found that you are using in by.kirich1409.viewbindingdelegate.ViewBindingProperty.kt file:

@RestrictTo(LIBRARY_GROUP)
public abstract class LifecycleViewBindingProperty<in R : Any, T : ViewBinding>(
    private val viewBinder: (R) -> T
) : ViewBindingProperty<R, T> {

  /* ... */

    private inner class ClearOnDestroyLifecycleObserver : DefaultLifecycleObserver {

        @MainThread
        override fun onDestroy(owner: LifecycleOwner): Unit = clear()
    }

  /* ... */

}
kirich1409 commented 3 years ago

And how it connected with the libraries?

abdulatif1707 commented 3 years ago

And how it connected with the libraries? I have updated my comment. please see it.

kirich1409 commented 3 years ago

You need to enable Java 8 in your project. More details here