Skip to content

Update dexmaker version to 2.28.3 for Android 14 support - #1107

Merged
Raibaz merged 1 commit into
mockk:masterfrom
kurteous:dexmaker-update-2.28.3
Jun 30, 2023
Merged

Raibaz merged 1 commit into
mockk:masterfrom
kurteous:dexmaker-update-2.28.3

Conversation

@kurteous

Copy link
Copy Markdown
Contributor

Android 14 requires read-only jar file creation, and the latest version of dexmaker has this change:

https://github.com/linkedin/dexmaker/blob/main/CHANGELOG.md
linkedin/dexmaker#181

Without this change, trying to mock certain classes on the Android 14 preview emulator results in this error:

io.mockk.MockKException: Can't instantiate proxy for class java.util.Date
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:64)
at io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:24)
...
Caused by: io.mockk.proxy.MockKAgentException: Failed to subclass class java.util.Date
at io.mockk.proxy.common.ProxyMaker.proxy(ProxyMaker.kt:63)
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:34)
... 52 more
Caused by: io.mockk.proxy.MockKAgentException: Failed to mock class java.util.Date
at io.mockk.proxy.android.transformation.AndroidSubclassInstrumentation.subclass(AndroidSubclassInstrumentation.kt:39)
at io.mockk.proxy.common.ProxyMaker.subclass(ProxyMaker.kt:140)
at io.mockk.proxy.common.ProxyMaker.proxy(ProxyMaker.kt:60)
... 53 more
Caused by: java.lang.RuntimeException: java.lang.SecurityException: Writable dex file '/data/user/0/com.aaa.bbb/app_dxmaker_cache/Generated_-1966060335.jar' is not allowed.
at com.android.dx.DexMaker.generateClassLoader(DexMaker.java:465)
at com.android.dx.DexMaker.generateAndLoad(DexMaker.java:519)
at com.android.dx.stock.ProxyBuilder.buildProxyClass(ProxyBuilder.java:335)
at io.mockk.proxy.android.transformation.AndroidSubclassInstrumentation.subclass(AndroidSubclassInstrumentation.kt:37)

@Raibaz
Raibaz merged commit 80e43ea into mockk:master Jun 30, 2023
@Raibaz

Raibaz commented Jun 30, 2023

Copy link
Copy Markdown
Collaborator

Thanks for putting this together!

@kurteous
kurteous deleted the dexmaker-update-2.28.3 branch June 30, 2023 15:41
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

Successfully merging this pull request may close these issues.

2 participants