Android app crashes at start with "E/dex2oat: Failed to create oat file" and "non-0 exit status"

knutella picture knutella · Jul 12, 2017 · Viewed 9.2k times · Source

My app (still WIP) runs fine on different devices. But suddenly it refuses to start on Huawei Honor 7 (Android 6.0/EMUI 4.0.3). Logcat gives me the following:

E/dex2oat: Failed to create oat file:
/data/dalvik-cache/arm64/data@[email protected]@[email protected]:
Permission denied

followed by

07-12 19:23:49.223
11280-11280/myapp.mycomp.de.myapp W/art: Failed
execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg
--debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/myapp.mycomp.de.myapp-1/split_lib_slice_1_apk.apk
--oat-file=/data/dalvik-cache/arm64/data@[email protected]@[email protected])
because non-0 exit status

This error occurs 9 times for spli_lib_slice_N_apk.apk-parts . I really have no idea, what it could be, especially since it run fine until today. I did no changes to the code. I also don't use any multidex, as far as I know.

Any hint appreciated, Thank you!

UPDATE JULY, 13TH 2017: I logged the appstart with a device on which it always works and I got the same "errors" like above. So it seems, that these messages may be normal... After this I had a look into the crashlog of the faulty device and found the following lines shortly AFTER the errors I posted above:

07-12 20:30:35.985 3209-3421/? I/logserver: extract_appname, forward search, appname=myapp.mycomp.de.myapp
07-12 20:30:35.985 3209-3421/? I/logserver: get_fault_appname, appname=myapp.mycomp.de.myapp
07-12 20:30:35.987 3209-3420/? I/logserver: handle_notify_event, send msg [submit:trigger=0,bugtype=2,modulename=myapp.mycomp.de.myapp,level=1,testtype=NORMAL,path=/data/log/unzip/PLK-L01_PLK-L01C432B390_0000000000_20170712203035_crash,mode=1;]
07-12 20:30:36.014 21797-21899/myapp.mycomp.de.myapp I/System: core_booster, getBoosterConfig = false
07-12 20:30:36.290 21797-21797/myapp.mycomp.de.myapp I/Process: Sending signal. PID: 21797 SIG: 9

It seems the process gets killed by Sigkill 9, see also on SE here: App dies with "Sending signal." but no exception or other info

But again I have no idea what causes this. After this I cleared the app-data within androids app-preferences and suddenly the app starts again. Investigation will continue...

Answer

Mac Tíre picture Mac Tíre · Nov 20, 2019

Try disabling instant run, take a look here

and then edit your main dex file, check out this resource on the android developer site to ensure you have the correct classes enabled in your main dex file