java.lang.RuntimeException: An error occurred while executing doInBackground()

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

You need the permission android.permission.READ_EXTERNAL_STORAGE. Write on the Android Manifest

tip

Android SDK 23 introduced a new way to handle permissions, so as a temporary workaround you can set it to build for SDK below 23. As a permanent solution you have to ask user during runtime for permissions with checkSelfPermission() or requestPermissions()

tip

MANAGE_USERS has a protection level of signature|system, so your application must be signed with the platform key. Take a look on this https://goo.gl/nXsTvH for more information about it.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Android N SetupWizard Issue
    via GitHub by Schischu
    ,
  • GitHub comment 73#243768635
    via GitHub by Blystad
    ,
  • Fatal exception error
    via Stack Overflow by user2850116
    ,
  • Class not working, Error occured?
    via Stack Overflow by Hari
    ,
  • Impacted Cases ============== Webapi usecase/Networking & Storage/FileReader Webapi usecase/Networking & Storage/FileSystem Webapi usecase/Device & Hardware/Camera Reproduce Test Steps ==================== 1. Download and install usecase_webapi_xwalk_tests.apk (download address please refer to the comment) 2. Launch the usecase_webapi_xwalk_tests.apk 3. Tap "Networking & Storage" -> Tap "FileReader" -> Tap "Open files" button -> Select an image, doc file, etc 5. Check the behavior Expected Outcome ================ Able to open the file Actual Outcome ============== App crash Test Builds =========== ||PackageVersion||Test Date|| Test Device ||Arch Mode|| Result|| |crosswalk 18.46.453.0|2015.12.16| Memo Pad8 | Shared / Embedded | {color:green}Pass{color} | |crosswalk 18.46.456.0|2015.12.21| Memo Pad8 | Shared / Embedded | {color:red}Fail{color} | Issue Analysis ============== Missing many permission compare with crosswalk 18.46.453.0. Error info: {code} E/XWalkViewInternal(11322): Unable to create Image File E/XWalkViewInternal(11322): java.io.IOException: open failed: EACCES (Permission denied) E/XWalkViewInternal(11322): at java.io.File.createNewFile(File.java:946) E/XWalkViewInternal(11322): at java.io.File.createTempFile(File.java:1011) E/XWalkViewInternal(11322): at org.xwalk.core.internal.XWalkViewInternal.createImageFile(XWalkViewInternal.java:1342) E/XWalkViewInternal(11322): at org.xwalk.core.internal.XWalkViewInternal.showFileChooser(XWalkViewInternal.java:1294) E/XWalkViewInternal(11322): at org.xwalk.core.internal.XWalkContentsClientBridge.shouldOverrideRunFileChooser(XWalkContentsClientBridge.java:644) E/XWalkViewInternal(11322): at org.xwalk.core.internal.XWalkWebContentsDelegateAdapter.shouldOverrideRunFileChooser(XWalkWebContentsDelegateAdapter.java:113) E/XWalkViewInternal(11322): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) E/XWalkViewInternal(11322): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:37) E/XWalkViewInternal(11322): at android.os.Handler.dispatchMessage(Handler.java:102) E/XWalkViewInternal(11322): at android.os.Looper.loop(Looper.java:149) E/XWalkViewInternal(11322): at android.app.ActivityThread.main(ActivityThread.java:5061) E/XWalkViewInternal(11322): at java.lang.reflect.Method.invokeNative(Native Method) E/XWalkViewInternal(11322): at java.lang.reflect.Method.invoke(Method.java:515) E/XWalkViewInternal(11322): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788) E/XWalkViewInternal(11322): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604) E/XWalkViewInternal(11322): at dalvik.system.NativeStart.main(Native Method) E/XWalkViewInternal(11322): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied) E/XWalkViewInternal(11322): at libcore.io.Posix.open(Native Method) E/XWalkViewInternal(11322): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) E/XWalkViewInternal(11322): at java.io.File.createNewFile(File.java:939) E/XWalkViewInternal(11322): ... 15 more ...... E/AndroidRuntime(11322): FATAL EXCEPTION: main E/AndroidRuntime(11322): Process: org.xwalk.usecase_webapi_xwalk_tests, PID: 11322 E/AndroidRuntime(11322): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://media/external/images/media/366 }} to activity {org.xwalk.usecase_webapi_xwalk_tests/org.xwalk.usecase_webapi_xwalk_tests.Usecase_webapi_xwalk_testsActivity}: java.lang.RuntimeException: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media/366 from pid=11322, uid=17435 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission() E/AndroidRuntime(11322): at android.app.ActivityThread.deliverResults(ActivityThread.java:3405) E/AndroidRuntime(11322): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3448) E/AndroidRuntime(11322): at android.app.ActivityThread.access$1300(ActivityThread.java:138) E/AndroidRuntime(11322): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284) E/AndroidRuntime(11322): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(11322): at android.os.Looper.loop(Looper.java:149) E/AndroidRuntime(11322): at android.app.ActivityThread.main(ActivityThread.java:5061) E/AndroidRuntime(11322): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(11322): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime(11322): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788) E/AndroidRuntime(11322): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604) E/AndroidRuntime(11322): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(11322): Caused by: java.lang.RuntimeException: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media/366 from pid=11322, uid=17435 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission() E/AndroidRuntime(11322): at org.xwalk.core.ReflectMethod.invoke(ReflectMethod.java:67) E/AndroidRuntime(11322): at org.xwalk.core.XWalkView.onActivityResult(XWalkView.java:546) E/AndroidRuntime(11322): at org.xwalk.app.runtime.XWalkCoreProviderImpl.onActivityResult(XWalkCoreProviderImpl.java:67) E/AndroidRuntime(11322): at org.xwalk.app.runtime.XWalkRuntimeView.onActivityResult(XWalkRuntimeView.java:135) E/AndroidRuntime(11322): at org.xwalk.app.XWalkRuntimeActivityBase.onActivityResult(XWalkRuntimeActivityBase.java:106) E/AndroidRuntime(11322): at android.app.Activity.dispatchActivityResult(Activity.java:5579) E/AndroidRuntime(11322): at android.app.ActivityThread.deliverResults(ActivityThread.java:3401) E/AndroidRuntime(11322): ... 11 more E/AndroidRuntime(11322): Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media/366 from pid=11322, uid=17435 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission() E/AndroidRuntime(11322): at android.os.Parcel.readException(Parcel.java:1465) E/AndroidRuntime(11322): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185) E/AndroidRuntime(11322): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137) E/AndroidRuntime(11322): at android.content.ContentProviderProxy.query(ContentProviderNative.java:413) E/AndroidRuntime(11322): at android.content.ContentResolver.query(ContentResolver.java:461) E/AndroidRuntime(11322): at android.content.ContentResolver.query(ContentResolver.java:404) E/AndroidRuntime(11322): at org.xwalk.core.internal.XWalkContentsClientBridge$1UriCallback.resolveFileName(XWalkContentsClientBridge.java:585) E/AndroidRuntime(11322): at org.xwalk.core.internal.XWalkContentsClientBridge$3.onReceiveValue(XWalkContentsClientBridge.java:625) E/AndroidRuntime(11322): at org.xwalk.core.internal.XWalkContentsClientBridge$3.onReceiveValue(XWalkContentsClientBridge.java:602) E/AndroidRuntime(11322): at org.xwalk.core.internal.XWalkViewInternal.onActivityResult(XWalkViewInternal.java:714) E/AndroidRuntime(11322): at org.xwalk.core.internal.XWalkViewBridge.onActivityResultSuper(XWalkViewBridge.java:399) E/AndroidRuntime(11322): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(11322): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime(11322): at org.xwalk.core.ReflectMethod.invoke(ReflectMethod.java:61) E/AndroidRuntime(11322): ... 17 more {code}
    via by Xie, XiaolongX,
    • java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:318) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{44db062 4211:com.google.android.setupwizard/u0a30} (pid=4211, uid=10030) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS at android.os.Parcel.readException(Parcel.java:1683) at android.os.Parcel.readException(Parcel.java:1636) at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:4169) at android.app.ActivityThread.acquireProvider(ActivityThread.java:5434) at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2273) at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1515) at android.content.ContentResolver.query(ContentResolver.java:514) at android.content.ContentResolver.query(ContentResolver.java:472) at com.google.android.setupwizard.user.ProfileHelper.updateMeContactWith(ProfileHelper.java:61) at com.google.android.setupwizard.user.NameCheckFragment$1.doInBackground(NameCheckFragment.java:73) at com.google.android.setupwizard.user.NameCheckFragment$1.doInBackground(NameCheckFragment.java:72) at android.os.AsyncTask$2.call(AsyncTask.java:304) at java.util.concurrent.FutureTask.run(FutureTask.java:237) ... 4 more

    Users with the same issue

    filipebatista
    filipebatista10 times, last one,
    winer222
    winer2223 times, last one,
    Indri Yunita
    Indri Yunita8 times, last one,
    gamebusterz
    gamebusterz7 times, last one,
    Riyaz
    Riyaz3 times, last one,
    231 more bugmates