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

java.lang.SecurityException: Writable dex file is not allowed. #236

Closed
andreik44455 opened this issue Dec 23, 2024 · 1 comment
Closed

Comments

@andreik44455
Copy link

andreik44455 commented Dec 23, 2024

After updating the target SDK to 35, the app builds but crashes at runtime with the following error:

FATAL EXCEPTION: main
Process: com.afwsamples.testdpc, PID: 10710
java.lang.RuntimeException: Unable to instantiate application com.google.devtools.build.android.incrementaldeployment.StubApplication package com.afwsamples.testdpc: java.lang.SecurityException: Writable dex file '/data/local/tmp/incrementaldeployment/com.afwsamples.testdpc/dex/incremental_classes2.dex' is not allowed.
	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1478)
	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1403)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7546)
	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2449)
	at android.os.Handler.dispatchMessage(Handler.java:109)
	at android.os.Looper.loopOnce(Looper.java:232)
	at android.os.Looper.loop(Looper.java:317)
	at android.app.ActivityThread.main(ActivityThread.java:8787)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)
Caused by: java.lang.SecurityException: Writable dex file '/data/local/tmp/incrementaldeployment/com.afwsamples.testdpc/dex/incremental_classes2.dex' is not allowed.
	at dalvik.system.DexFile.openDexFileNative(Native Method)
	at dalvik.system.DexFile.openDexFile(DexFile.java:406)
	at dalvik.system.DexFile.<init>(DexFile.java:128)
	at dalvik.system.DexFile.<init>(DexFile.java:101)
	at dalvik.system.DexPathList.loadDexFile(DexPathList.java:438)
	at dalvik.system.DexPathList.makeDexElements(DexPathList.java:387)
	at dalvik.system.DexPathList.<init>(DexPathList.java:166)
	at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:160)
	at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:105)
	at com.google.devtools.build.android.incrementaldeployment.IncrementalClassLoader$DelegateClassLoader.<init>(IncrementalClassLoader.java:57)
	at com.google.devtools.build.android.incrementaldeployment.IncrementalClassLoader$DelegateClassLoader.<init>(IncrementalClassLoader.java:54)
	at com.google.devtools.build.android.incrementaldeployment.IncrementalClassLoader.createDelegateClassLoader(IncrementalClassLoader.java:96)
	at com.google.devtools.build.android.incrementaldeployment.IncrementalClassLoader.<init>(IncrementalClassLoader.java:38)
	at com.google.devtools.build.android.incrementaldeployment.IncrementalClassLoader.inject(IncrementalClassLoader.java:113)
	at com.google.devtools.build.android.incrementaldeployment.StubApplication.instantiateRealApplication(StubApplication.java:338)
	at com.google.devtools.build.android.incrementaldeployment.StubApplication.attachBaseContext(StubApplication.java:546)
	at android.app.Application.attach(Application.java:346)
	at android.app.Instrumentation.newApplication(Instrumentation.java:1355)
	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1471)
	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1403) 
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7546) 
	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2449) 
	at android.os.Handler.dispatchMessage(Handler.java:109) 
	at android.os.Looper.loopOnce(Looper.java:232) 
	at android.os.Looper.loop(Looper.java:317) 
	at android.app.ActivityThread.main(ActivityThread.java:8787) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871) 

Android Studio details:
Android Studio Ladybug | 2024.2.1 Patch 3
Build #AI-242.23339.11.2421.12700392, built on November 22, 2024
Runtime version: 21.0.3+-79915917-b509.11 aarch64

Bazel version:
bazel 7.4.1-homebrew

@pfmaggi
Copy link
Collaborator

pfmaggi commented Jan 8, 2025

Updating the target to SDK35 requires some refactoring of the application. As-is crashes are expected.

@pfmaggi pfmaggi closed this as completed Jan 8, 2025
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

2 participants