Failed to create oat file

7.2k views Asked by At

I develop an app that intent to Camera application to take picture and save it.

but my problem is :

sometimes after picture taken and my app called ,my application crashed(without onActivityResult() called).

my application use multidex and I can't remove it. also instant run is enable.

this is my code :

protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        if (requestCode == REQUEST_TAKE_PHOTO) {
            if (resultCode == RESULT_OK) {
               // if intent!= null and intent.getData() != null 
               //     do some thing ...     
            }
        }
    }

public void take_picture()
{
    takePictureIntent.putExtra(
                    MediaStore.EXTRA_OUTPUT,
                    Uri.fromFile(new File(/*valid loction*/))
            );
     startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
}

my application don't log any error but android OS log this:

    09-11 16:05:48.720 10206-10229/? E/OpaEligibilityChecker: Updating xpromo flags, clock app not present.
09-11 16:05:49.090 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:49.090 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:49.190 440-1316/? E/qomx_image_core: OMX_Deinit:118] Complete
09-11 16:05:49.190 440-1316/? E/QCameraPostProc: int32_t qcamera::QCameraPostProcessor::deinit(): Jpeg closed, rc = 0, mJpegClientHandle = 4d00
09-11 16:05:49.200 462-10261/? E/mm-camera-sensor: module_sensor_stop_session:867 session 1
09-11 16:05:49.200 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 5
09-11 16:05:49.200 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 4
09-11 16:05:49.210 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 3
09-11 16:05:49.210 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 2
09-11 16:05:49.210 462-10261/? E/mm-camera-sensor: sensor_close:3967 (0)sensor_close CFG_POWER_DOWN 
09-11 16:05:49.210 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 1
09-11 16:05:49.240 462-10261/? E/mm-camera-sensor: module_sensor_stop_session:902 module_sensor_stop_session:send stop sensor thread,fd:29
09-11 16:05:49.250 462-9993/? E/mm-camera: Got some events
    sensor_thread_func:160 sensor_thread_func:Sensor thread is exiting
09-11 16:05:49.250 462-462/? E/mm-camera: mct_pipeline_stop_session: left modules: 0
09-11 16:05:49.260 9868-9918/? E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
09-11 16:05:49.610 10281-10281/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:50.260 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:50.260 1779-1779/? E/com.android.phone.util.Constants: com.htc.lib0.HDKLib0Util$HDKException: get Class HtcIntents==null
09-11 16:05:50.560 10339-10339/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:50.640 10342-10342/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:50.720 10349-10349/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:50.790 10351-10351/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:50.850 10353-10353/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:50.930 10356-10356/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:50.980 10359-10359/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:51.070 10363-10363/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:51.140 10366-10366/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:51.230 10370-10370/? E/dex2oat: Failed to create oat file: /data/dalvik-cache/arm64/data@app@AppName@[email protected]: Permission denied
09-11 16:05:52.660 10267-10267/ir.abfacs.abfacsandroid E/Photo test: 1-mCurrentPhotoPath: null
1

There are 1 answers

0
Amir133 On BEST ANSWER

finally for solving this problem I disabled 'instant run' and also edit my primary dex file. see this (topic : Declare classes required in the primary DEX file)