linkedin / dexmaker

A utility for doing compile or runtime code generation targeting Android's Dalvik VM
Apache License 2.0
1.86k stars 248 forks source link

java.lang.SecurityException: Writable dex file error when executing on Android 14 #188

Open vyvanhungbg opened 8 months ago

vyvanhungbg commented 8 months ago

Hi everybody. I recently encountered an error on android 14. Specifically from change Change list android 14. I am using reflection for an application function but it seems that the change from Android 14 is not allowing recording from DCL so the feature is affected. Is there any way to handle this case?. Thanks everyone

java.lang.RuntimeException: java.lajava.lang.RuntimeException java.lang.SecurityException: Writable dex file '/data/user/0/com.android.example/code_cache/v1/Generated_1202068130.jar' is not allowed.
2024-01-05 09:47:47.354 14625-14625 System.err              com.android.example  W      at com.android.dx.DexMaker.generateClassLoader(DexMaker.java:464)
2024-01-05 09:47:47.355 14625-14625 System.err              com.android.example  W      at com.android.dx.DexMaker.generateAndLoad(DexMaker.java:538)
2024-01-05 09:47:47.355 14625-14625 System.err              com.android.example  W      at com.android.dx.stock.ProxyBuilder.buildProxyClass(ProxyBuilder.java:337)
2024-01-05 09:47:47.355 14625-14625 System.err              com.android.example  W      at com.android.dx.stock.ProxyBuilder.build(ProxyBuilder.java:236)
kkoser commented 8 months ago

Hi @vyvanhungbg , can you share the version of dexmaker you're using? The most recent release contains some fixes for Android 14, see #181 which is in version 2.28.3 (the latest)