user3147973
user3147973

Reputation: 435

Adobe Air File.open generates error #3003 on Android

I'm doing something really simple - so there must be silly mistake somewhere here. I'm building my game with:

adt -package -target apk-debug -connect  -storetype pkcs12 -keystore "cert\mygame.p12" -storepass fd "dist\mygame-debug.apk" "application.xml" -C bin . -C "icons/android" .

With the swfs and required data files in the bin/ folder. That -C directive should make them work as root, as per Adobe docs. Then in code all I'm doing is:

var file:File = File.applicationDirectory.resolvePath("data.json");
var fin:FileStream = new FileStream();
fin.open(file, FileMode.READ);     // error 3003 triggered!!

The path is resolved to "app:/data.json" which is correct, since it lives in the apk in the same place the swf is.

So why am I getting error 3003? Any insight is greatly appreciated!

I'm building with Air 3.7.

Thanks!

Upvotes: 0

Views: 1099

Answers (3)

Anton Vladimirovich
Anton Vladimirovich

Reputation: 175

firstly update your air to 13 from labs.adobe.com if updated air sdk will not solve issue - try to use URLLoader instead FileStream

Upvotes: 0

Josh
Josh

Reputation: 8149

Make sure you have this permission enabled in your app.xml file.

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

Upvotes: 1

CyanAngel
CyanAngel

Reputation: 1238

File.applicationDrectory represents the folder your app is installed to on the device. In Android this directory is heavily protected, you need root access to read from there (which I'm assuming you don't have). File.applicationStorageDirectory is a more preferable place to read/write from, this is within your applications "sandbox" (no other apps, or the user, can access it without root access, but your app can).

Upvotes: 0

Related Questions