0

I'm getting a very strange situation while developing an AIR application for android: - I am getting error #3001 - "File or directory access denied" when I am trying to copy files to the sdcard. I have added the following permission to the manifest but it did not fix the issue:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

I have tried to unplug the usb cord prior to launching the app in order to avoid any collisions but it doesnt help. The sdcard "lock" button remains in "unlocked" state. I have also tried to use another sdcard but the result is the same.

The version of android is 4.0.4 and the air sdk is 3.2

Any advice will be highly appreciated.

UPDATE 4/8/2014

My apologies, in fact the copy operation throws error 3002 - file or directory exists and the error 3001 is frown by destinationDir.createDirectory() which goes before it. However it becomes more incomprehensible since sd card is empty and I dont see anything on it. As I see from debugger the "exists" property of destination is false so I really dont understand why it throws error 3002.

Here is the source which provokes the exception:

var sourceDir:File = File.applicationDirectory.resolvePath(Model.INTERNAL_ASSETS_FOLDER);               
var destination:File = Model.externalAssetsDirectory;

try {
        if (!destination.exists) {
            destination.createDirectory();
        }

        sourceDir.copyTo(destination, true);

} catch (e:Error) {
        trace(e.message)
}
4

1 に答える 1