https://kotlinlang.org logo
#mockk
Title
# mockk
r

Raul

03/24/2023, 4:41 PM
Hi. This is a simplified version of the issue I have. I've got this in an Android project
Copy code
class A(){
   val flow: Flow<Boolean> = flowOf(true)
}

class B (a: A) {
   val otherFlow = a.flow
}
and in one test:
Copy code
@RelaxedMockK //or MockK, I've tried both
    protected lateinit var a: A
    
    protected lateinit var b: B
    
    @Before
    fun setUp() {
        MockKAnnotations.init(this, relaxed = true)
        b = B(a)
    }
This is working fine with MockK
1.13.3
, but after updating to
1.13.4
I'm getting the error
Copy code
java.lang.IncompatibleClassChangeError: Superclass kotlinx.coroutines.flow.Flow of kotlinx.coroutines.flow.Flow_1_Proxy is an interface (declaration of 'kotlinx.coroutines.flow.Flow_1_Proxy' appears in /data/user/0/com.mypackage.myapp.debug/app_dxmaker_cache/Generated_2115397682.jar)
Am I missing something? 🤷 🤔
it's working in Unit test, and failing in instrumental test, if that info rings anyone's bell
j

Jonas

03/27/2023, 12:07 PM
We have a similar issue on our side. Also downgraded to
1.13.3
for the time being. Will check again later if it is the exact same issue.
Yes, same issue:
Copy code
java.lang.IncompatibleClassChangeError: Superclass kotlinx.coroutines.flow.StateFlow of kotlinx.coroutines.flow.StateFlow_1_Proxy is an interface (declaration of 'kotlinx.coroutines.flow.StateFlow_1_Proxy' appears in
Any idea what could have changed @Mattia Tommasone?
m

Mattia Tommasone

04/05/2023, 7:27 AM
no idea off the top of my head, let me investigate
it appears to be because of incompatible class versions what kotlin version are you on?
j

Jonas

04/05/2023, 7:30 AM
Copy code
1.8.10
atm
m

Mattia Tommasone

04/05/2023, 7:43 AM
weird can you do a test with 1.8.0?
j

Jonas

04/05/2023, 7:47 AM
yes - give me a second
same issue
Is there anything else I can test for you?
304 Views