You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/06/19 13:45:01 UTC

[GitHub] [cordova-plugin-file] AleFons opened a new issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

AleFons opened a new issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   
   It should be able to access public files.
   
   ### What does actually happen?
   
   When attempting to access a file from outside the app's dataDirectory on Android 10, the plugin returns a `FILE_NOT_FOUND_ERR`.
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   
   Android 10 comes with [some changes in privacy](https://developer.android.com/about/versions/10/privacy/changes) that seem to be the cause; this problem specifically happens to me when I use the Camera plugin to select a picture from the photo roll and make a backup of it; when attempting to copy it to the app's directory, I get that error.
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   ```
   public async backupAnnexedFile(content_uri) {
       let link = content_uri;
       if (this.platform.is('android')) {
         link = await this.file_path.resolveNativePath(content_uri);
       }
       let old_path = link.slice(0, link.lastIndexOf('/') + 1);
       let old_filename = link.slice(link.lastIndexOf('/') + 1, link.length);
       let extension = old_filename.slice(old_filename.lastIndexOf('.'), old_filename.length);
       let new_path = 'path/to/file/';
       if (this.platform.is('cordova')) {
         new_path = this.fileHandler.dataDirectory.toString();
       }
       let new_filename = 'L_';
       new_filename = `${new_filename}${Date.now()}${extension}`;
       await this.fileHandler.copyFile(old_path, old_filename, new_path, new_filename).catch((error) => {
         console.log(error);
         throw error;
       });
       return `${new_path}${new_filename}`;
     }
   ```
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   
   Android 10, has happened on multiple devices.
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   Ionic:
   
   ionic (Ionic CLI) : 4.6.0
   Ionic Framework : ionic-angular 3.9.6
   @ionic/app-scripts : 3.2.4
   
   Cordova:
   
   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0, ios 5.0.0
   Cordova Plugins : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 2.2.0, (and 18 other plugins)
   
   System:
   
   Android SDK Tools : 26.1.1
   NodeJS : v12.16.3
   npm : 6.14.4
   OS : Linux 4.15
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X] I searched for existing GitHub issues
   - [X] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] hanatharesh2712 commented on issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
hanatharesh2712 commented on issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397#issuecomment-743238322


   @fabien44300 Not able to build the app with above settings with cordova android 8.1.0 
   
   I set it like as below:
   ```
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
               <application android:usesCleartextTraffic="true" />
               <application android:requestLegacyExternalStorage="true" />
           </edit-config>
   ```
   
   Which Cordova version are you using?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397#issuecomment-691470588


   I saw similar behaviour when testing a PR in `cordova-plugin-media-capture`.
   
   I see you were using `android 8.1.0` which by default targets API 28, but did you have this overriden to target API 29 by chance?
   
   If so, could you try testing the PR https://github.com/apache/cordova-plugin-file/pull/417 to see if this solves the issue for you?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397#issuecomment-830845905


   Duplicate of https://github.com/apache/cordova-plugin-file/issues/426


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek closed issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
breautek closed issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] fabien44300 commented on issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
fabien44300 commented on issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397#issuecomment-707688273


   Hello,
   
   In AndroidManifest.xml, I add these 2 informations and now I can save in cordova.file.externalRootDirectory with Android 10 :
   
    <application ........   **android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true"**>
   
   I hope, it can help you.
   
   Fabien


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397#issuecomment-691470588


   I saw similar behaviour when testing a PR in `cordova-plugin-media-capture`.
   
   I see you were using `android 8.1.0` which by default targets API 28, but did you have this overriden to target API 29 by chance?
   
   If so, could you try testing the PR https://github.com/apache/cordova-plugin-file/pull/417 to see if this solves the issue for you?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397#issuecomment-691470588






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #397: Attempting to access an external file on Android 10 causes FILE_NOT_FOUND_ERR

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #397:
URL: https://github.com/apache/cordova-plugin-file/issues/397#issuecomment-691470588






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org