Copy link to clipboard
Copied
When I call cameraRoll.addBitmapData() on Android, I get a #2038 file I/O error which probably is due to a security issue. This happens with AIR SDK 30 Beta. I didn't have this issue with AIR SDK 24. I check for CameraRoll permissions, but still get this error when permission is granted. I’ve verified that the Android manifest has <uses-permission android:name=“android.permission.WRITE_EXTERNAL_STORAGE”/>. I’ve reduced the dimensions of the image to be half its size (now 720x936). I'm still getting this error and don't know what else to check.
Is it possible that this issue is with the AIR SDK 30 itself? Have others seen this issue with the AIR SDK 30? Is there something else I need to try that doesn't involve using older SDKs?
Thanks.
Rick Hocker
Copy link to clipboard
Copied
The whole way that permissions are done was changed with Android 6, to make it more like iOS, and in AIR 24 the way it works was changed to be the same approach for both platforms.
See this article, and check if the way you're doing it is how AIR 24 and later needs it to be:
12/13/2016 - Release - AIR 24 Runtime and SDK
The XML changes you made would be used for Android 4 and 5, but if you're setting a minimum of Android 6, then you have to work in the newer permissions way.
Copy link to clipboard
Copied
I implemented permissions and it works now for iOS, but Android is still giving me the #2038 error whether I set the targetSDK to 16 or 24. We were using AIR 24 prior and it worked fine without permissions because we were targeting Android SDK 16. We jumped from AIR 24 to 30 so I don't know if saving to the CameraRoll might have worked in versions 25-29. The upgrade from 24 to 30 introduced the #2038 error. I'm combing forums to learn more about the #2038 error.
Copy link to clipboard
Copied
If you check the error details, does it give any more information? Here are some lines from my app that saves pictures (cr is just CameraRoll, bdToSave is the bitmapdata set up somewhere else), where I listen for the camera error event:
private function saveCamera(){
try {
cr.addEventListener(Event.COMPLETE, onSave);
cr.addEventListener(ErrorEvent.ERROR,camerror);
cr.addBitmapData(bdToSave);
} catch (err){
trace("camera fail:",err);
noSave();
}
}
private function camerror(e:ErrorEvent){
trace("camera error:",e);
noSave();
}