Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewBindingKotlinModel Proguard problem with latest gradle #1365

Open
AbdelrahmanHesham14 opened this issue Oct 19, 2023 · 8 comments
Open

Comments

@AbdelrahmanHesham14
Copy link

Fatal Exception: java.lang.NullPointerException: null cannot be cast to non-null type java.lang.Class<*>
       at com.qawafel.core.epoxy.ViewBindingKotlinModelKt.getSuperclassParameterizedType(ViewBindingKotlinModel.kt:73)
       at com.qawafel.core.epoxy.ViewBindingKotlinModelKt.getSuperclassParameterizedType(ViewBindingKotlinModel.kt:73)
       at com.qawafel.core.epoxy.ViewBindingKotlinModelKt.getSuperclassParameterizedType(ViewBindingKotlinModel.kt:73)
       at com.qawafel.core.epoxy.ViewBindingKotlinModelKt.getSuperclassParameterizedType(ViewBindingKotlinModel.kt:73)
       at com.qawafel.core.epoxy.ViewBindingKotlinModelKt.getBindMethodFrom(ViewBindingKotlinModel.kt:64)
       at com.qawafel.core.epoxy.ViewBindingKotlinModelKt.access$getBindMethodFrom(ViewBindingKotlinModel.kt:1)
       at com.qawafel.core.epoxy.ViewBindingKotlinModel$bindingMethod$2.invoke(ViewBindingKotlinModel.kt:29)
       at com.qawafel.core.epoxy.ViewBindingKotlinModel$bindingMethod$2.invoke(ViewBindingKotlinModel.java:29)
@AbdelrahmanHesham14 AbdelrahmanHesham14 changed the title ViewBindingKotlinModel Proguary problem with latest gradle ViewBindingKotlinModel Proguard problem with latest gradle Oct 19, 2023
@BlackFish768
Copy link

Same here. +1

I added this in Proguard as mentioned in the ViewBindingKotlinModel class

-keepclassmembers class * extends androidx.viewbinding.ViewBinding {
public static *** bind(android.view.View);
}

but still getting the same NullPointerException.

@AbdelrahmanHesham14
Copy link
Author

@BlackFish768 Yes it's very weired
@elihart Please advise here

@lwirasatria99
Copy link

me too, error when minifyEnable = true
I use gradle 8.1.0

@john-tadebois
Copy link

I get the same error with the following specs:

AGP 8.0.0
com.airbnb.android:epoxy - v5.1.3
Same stacktrace as posted in the details of this issue.

@AbdelrahmanHesham14
Copy link
Author

No response from the team till now !
Anyone found a solution ?!

@shawnlinboy
Copy link

Related issue: #1122

@cemore2048
Copy link

cemore2048 commented Mar 19, 2024

Don't know how helpful this is a year and a half later. When you update to AGP 8 it forces android.enableR8.fullMode to true. it's a more aggressive code minification. you have to explicitly set it to false in your gradle.properties file

android.enableR8.fullMode=false

That should avoid the need to figure out what rule to add

@Nephys222
Copy link

@cemore2048 solutions fixed for me. But does it acceptable to close the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants