[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joe Bowser updated CB-9068: --- Priority: Critical (was: Major) FileWriter.write() failure on Lollipop when no ext_sdcard present - Key: CB-9068 URL: https://issues.apache.org/jira/browse/CB-9068 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 5.0.0 Environment: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 / 5.1.1 cordova-android 4.0.0 / 4.0.2 Reporter: Tanase Butcaru Assignee: Joe Bowser Priority: Critical Labels: file, fileWriter, writer FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. --- I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... --- I | chromium |
[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tanase Butcaru updated CB-9068: --- Environment: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 / 5.1.1 cordova-android 4.0.0 / 4.0.2 was: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 / 5.1.1 cordova-android 4.0.0 FileWriter.write() failure on Lollipop when no ext_sdcard present - Key: CB-9068 URL: https://issues.apache.org/jira/browse/CB-9068 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 5.0.0 Environment: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 / 5.1.1 cordova-android 4.0.0 / 4.0.2 Reporter: Tanase Butcaru Assignee: Joe Bowser Labels: file, fileWriter, writer FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset
[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tanase Butcaru updated CB-9068: --- Environment: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 / 5.1.1 cordova-android 4.0.0 was: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 cordova-android 4.0.0 FileWriter.write() failure on Lollipop when no ext_sdcard present - Key: CB-9068 URL: https://issues.apache.org/jira/browse/CB-9068 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 5.0.0 Environment: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 / 5.1.1 cordova-android 4.0.0 Reporter: Tanase Butcaru Assignee: Joe Bowser Labels: file, fileWriter, writer FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset manifest not found. Recursive
[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tanase Butcaru updated CB-9068: --- Description: FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. --- I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... --- I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... --- W | ContextImpl | Failed to ensure directory: /storage/sdcard1/Android/media/cdv.filewriter.issue --- I | chromium | [INFO:CONSOLE(253)] Write to file FAIL: -- {type:error,bubbles:false,cancelBubble:false,cancelable:false,lengthComputable:false,loaded:0,total:0,target:{fileName:,length:23,localURL:cdvfile://localhost/files/fileWriter.txt,position:0,readyState:2,result:null,error:{code:6},onwritestart:null,onprogress:null,onwriteend:null,onabort:null}}, source: ... ANDROID 5.0.2 with extSD same output as 4.4.4 ANDROID 5.0.1 5.1.1 without
[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tanase Butcaru updated CB-9068: --- Description: FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. --- I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... --- I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... --- W | ContextImpl | Failed to ensure directory: /storage/sdcard1/Android/media/cdv.filewriter.issue --- I | chromium | [INFO:CONSOLE(253)] Write to file FAIL: -- {type:error,bubbles:false,cancelBubble:false,cancelable:false,lengthComputable:false,loaded:0,total:0,target:{fileName:,length:23,localURL:cdvfile://localhost/files/fileWriter.txt,position:0,readyState:2,result:null,error:{code:6},onwritestart:null,onprogress:null,onwriteend:null,onabort:null}}, source: ... ANDROID 5.0.2 with extSD same output as 4.4.4 ANDROID 5.0.1 5.1.1 without
[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tanase Butcaru updated CB-9068: --- Description: FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. --- I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... --- I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... --- W | ContextImpl | Failed to ensure directory: /storage/sdcard1/Android/media/cdv.filewriter.issue --- I | chromium | [INFO:CONSOLE(253)] Write to file FAIL: -- {type:error,bubbles:false,cancelBubble:false,cancelable:false,lengthComputable:false,loaded:0,total:0,target:{fileName:,length:23,localURL:cdvfile://localhost/files/fileWriter.txt,position:0,readyState:2,result:null,error:{code:6},onwritestart:null,onprogress:null,onwriteend:null,onabort:null}}, source: ... ANDROID 5.0.2 with extSD same output as 4.4.4 ANDROID 5.0.1 5.1.1 without
[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joe Bowser updated CB-9068: --- Priority: Major (was: Blocker) FileWriter.write() failure on Lollipop when no ext_sdcard present - Key: CB-9068 URL: https://issues.apache.org/jira/browse/CB-9068 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 5.0.0 Environment: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 cordova-android 4.0.0 Reporter: Tanase Butcaru Labels: file, fileWriter, writer FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. --- I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... --- I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ...
[jira] [Updated] (CB-9068) FileWriter.write() failure on Lollipop when no ext_sdcard present
[ https://issues.apache.org/jira/browse/CB-9068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tanase Butcaru updated CB-9068: --- External issue URL: http://stackoverflow.com/questions/30417959/filewriter-write-failure-on-lollipop-when-no-ext-sdcard-present FileWriter.write() failure on Lollipop when no ext_sdcard present - Key: CB-9068 URL: https://issues.apache.org/jira/browse/CB-9068 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin File Affects Versions: 5.0.0 Environment: Android Emulator (4.4.2, 5.0.1 and 5.1.1) Xperia Sola (with 4.4.4) Xperia Z3 Compact (5.0.2) Cordova 5.0.0 cordova-android 4.0.0 Reporter: Tanase Butcaru Priority: Blocker Labels: file, fileWriter, writer FileWriter write method fails on android lollipop versions when no external sdcard is present. Simple test case: {code:javascript} function fwriteTest(){ console.log(START FILE WRITE!!); console.log(CDV dataDirectory: + cordova.file.dataDirectory); window.resolveLocalFileSystemURL(cordova.file.dataDirectory, resolveLocalFSUrlWin, resolveLocalFSUrlErr); } function resolveLocalFSUrlErr(err){ console.log(resolve FS ERR: -- + JSON.stringify(err)); } function resolveLocalFSUrlWin(dirEntry){ console.log(resolve FS WIN!!); dirEntry.getFile('fileWriter.txt', { create: true, exclusive: false }, getFileWin, getFileErr); } function getFileErr(err){ console.log(get file ERR: -- + JSON.stringify(err)); } function getFileWin(fileEntry){ console.log(get file WIN!!); fileEntry.createWriter( function(writer){ writer.onwrite = function(evt){ console.log(Write to file WIN!!); alert(ALL GOOD!!); }; writer.onerror = function(err){ console.log(Write to file FAIL: -- + JSON.stringify(err)); } writer.write(sample text goes hereee); }, function(err){ console.log(create writer ERR: -- + JSON.stringify(err)); } ); } //run test! fwriteTest(); {code} AndroidManifest.xml contains the following permission, so it's all good here: {code:xml}uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /{code} I have two android devices, different android versions (4.4.4 and 5.0.2) and I have 3 android emulators with android 4.4.2, 5.0.1 and 5.1.1. I tested all environments with and without ext_sdcard (for emulators do not enter Size for Sd card option) and here are my results: {noformat} Android 4.4.4 with without extSD (XPERIA Sola) == LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ... I | chromium | [INFO:CONSOLE(243)] get file WIN!!, source: ... D | TEST | cdvfile://localhost/files/fileWriter.txt: 23 I | chromium | [INFO:CONSOLE(248)] Write to file WIN!!, source: ... ANDROID 4.4.2 without sdcard / with sdcard (EMULATOR) == same output as XPERIA Sola ANDROID 5.0.2 without extSD (XPERIA Z3 Compact) === LEVEL | TAG | TEXT === I | chromium | [INFO:CONSOLE(228)] START FILE WRITE!!, source: ... --- I | chromium | [INFO:CONSOLE(229)] CDV dataDirectory: file:///data/data/cdv.filewriter.issue/files/, source: ... --- W | AssetFilesystem | Asset manifest not found. Recursive copies and directory listing will be slow. --- I | chromium | [INFO:CONSOLE(236)] resolve FS WIN!!, source: ...