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

Update dexmaker version to 2.28.3 for Android 14 support #1107

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

kurteous
Copy link
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
26 checks passed
@Raibaz
Copy link
Collaborator

Raibaz commented Jun 30, 2023

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.

None yet

2 participants