Failed to open dex file, unrecognized version number

6.2k views Asked by At

I've pushed an apk to system/priv-app on my tv box, but I get this error when I try to uninstall an app:

dex2oat : Failed to create oat file: /data/dalvik-cache/arm/system@priv-app@[email protected]@classes.dex: Permission denied
dex2oat : dex2oat took 803.750us (threads: 4)
art     : Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a9 --instruction-set-features=default --dex-file=/system/priv-app/CanvasPackageInstaller/CanvasPackageInstaller.apk --oat-file=/data/dalvik-cache/arm/system@priv-app@[email protected]@classes.dex) because non-0 exit status
art     : Failed to open dex file '/system/priv-app/CanvasPackageInstaller/CanvasPackageInstaller.apk' from memory: Unrecognized version number in /system/priv-app/CanvasPackageInstaller/CanvasPackageInstaller.apk: 0 3 7 

I've tried to clean the dalvik-cache but with no success. What does it mean ?

3

There are 3 answers

0
JesusFreke On BEST ANSWER

The 037 version of the dex format was introduced in the N timeframe. Devices with a version of Android older than N won't be able to read it.

0
teoking On

For me, I got the similar error when installing an debug apk which was built with an Android 11 device to an Android 8 device.

Two ways to solve this:

  1. Connect the target device and rebuild the app in Android Studio.
  2. Clean and build from command line then install the out apk to the target device.

This may not happend for a release apk.

1
Vladimir Koltunov On

In my case problem was solved by enabling Instant Run. On each start of application there was prompt (Install Android 7 platform for instant run/Continue without instant run). When i press SKIP, there was same exception (dex version... bla-bla) for some apks. Installing appropriate platform dismissed exception.