Android Question Error open failed: EBUSY (Device or resource busy)

Alberto Michelis

Well-Known Member
Licensed User
Tablet with Android 5.0

How to trap it or to sort it out???

I suppouse it happens when...

B4X:
    If File.Exists(File.DirDefaultExternal, "Params") = False Then
        Log("instala params")
        File.Copy(File.DirAssets, "Params", File.DirDefaultExternal, "Params")
        PrimeraInstalacion=1
    End If
    If File.Exists(File.DirDefaultExternal, "portit.db") = False Then
        'copy the default DB
        Log("instala db")
        File.Copy(File.DirAssets, "portit.db", File.DirDefaultExternal, "portit.db")
        PrimeraInstalacion=1
        dbInstalada="1"
    End If
This is the error log...

B4X:
LogCat connected to: B4A-Bridge: LGE LG-V400
--------- beginning of system
--------- beginning of main
sale de decidir con vuelta 7 USA U$S
Installing file.
PackageAdded: package:armi.portit
Copying updated assets files (66)
java.lang.RuntimeException: java.io.FileNotFoundException: /storage/emulated/0/Android/data/armi.portit/files/virtual_assets/addeft.bal: open failed: EBUSY (Device or resource busy)
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:159)
    at anywheresoftware.b4a.shell.Shell.start(Shell.java:91)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:76)
    at armi.portit.main.afterFirstLayout(main.java:92)
    at armi.portit.main.access$100(main.java:17)
    at armi.portit.main$WaitForLayout.run(main.java:78)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5349)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/data/armi.portit/files/virtual_assets/addeft.bal: open failed: EBUSY (Device or resource busy)
    at libcore.io.IoBridge.open(IoBridge.java:456)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370)
    at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:146)
    ... 13 more
Caused by: android.system.ErrnoException: open failed: EBUSY (Device or resource busy)
    at libcore.io.Posix.open(Native Method)
    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
    at libcore.io.IoBridge.open(IoBridge.java:442)
    ... 16 more
 

Alberto Michelis

Well-Known Member
Licensed User
Using DirDefaultExternal, am I forcing the user to have an SD card inserted?
May be I have to change it, which is the convenient dir?
Thanks
 
Top