I have been testing one of my apps on Google's emulator under various different SDK platform levels and have stumbled upon weird behavior that is only shown under SDK17. The attached Project exhibits the problem however it simply consists of the following line:
On all SDK levels that I have tested (16, 17, 18, 19) the above line is successful (since there is the appropriate WRITE_EXTERNAL_STORAGE permission) apart from on 17. On 17 I get the error:
I have tried deleting and recreating the platform 17 AVD, but I still see the same error. Any ideas?
Thanks.
B4X:
File.Copy(File.DirAssets, "b4a.png", File.DirRootExternal, "b4a.png")
On all SDK levels that I have tested (16, 17, 18, 19) the above line is successful (since there is the appropriate WRITE_EXTERNAL_STORAGE permission) apart from on 17. On 17 I get the error:
B4X:
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
Copying updated assets files (2)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 43 (Main)
java.io.FileNotFoundException: /mnt/sdcard/b4a.png: open failed: EACCES (Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:373)
at anywheresoftware.b4a.objects.streams.File.Copy(File.java:339)
at b4a.example.main._button1_click(main.java:410)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:400)
... 26 more
** Activity (main) Pause, UserClosed = true **
I have tried deleting and recreating the platform 17 AVD, but I still see the same error. Any ideas?
Thanks.