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/08/07 10:27:50 UTC

[GitHub] [cordova-plugin-file] pepenemo commented on issue #408: Platform android@9.0.0 running on Android 10 : getFile produces INVALID_MODIFICATION_ERR - Error code 9.

pepenemo commented on issue #408:
URL: https://github.com/apache/cordova-plugin-file/issues/408#issuecomment-670449055


   > I can confirm that the same line from PR #410 put manually in config.xml solves the problem.
   > I could not install PR 410 since that exact line was conflicting with an edit-config tag we have i our config.xml.
   > 
   > Just to add some details, we had this line in our config.xml:
   > 
   > ```
   > <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
   >    <application android:usesCleartextTraffic="true" />
   > </edit-config>
   > ```
   > 
   > Installing @eliadAfeka 's fork gave us this error:
   > 
   > ```
   > Failed to install 'cordova-plugin-file': Error: cordova-plugin-file cannot be added. <edit-config> changes in this plugin conflicts with <edit-config> changes in config.xml. Conflicts must be resolved before plugin can be added.
   > ```
   > 
   > So we edited our config.xml to look like this:
   > 
   > ```
   > <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
   >    <application android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true"/>
   > </edit-config>
   > ```
   > 
   > and the problem seems to be solved.
   > 
   > Thanks everyone for your help.
   
   I had the same issue and it was fixed of the comment added  by @rastafan(_quoted reply_) in my Samsung phone - Android 10. I added the code - "android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true"" in the directory <ProjectName>/plaforms/android/app/src/main/AndroidManifest.xml
   
   My AndroidManifest file looks like this:
   `<?xml version='1.0' encoding='utf-8'?>
   <manifest android:hardwareAccelerated="true" android:versionCode="#" android:versionName="#.###.##" package="com.projectName.projectName" xmlns:android="http://schemas.android.com/apk/res/android">
       <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
       <uses-permission android:name="android.permission.INTERNET" />
       <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true" android:supportsRtl="true" android:usesCleartextTraffic="true">
           <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
               <intent-filter android:label="@string/launcher_name">
                   <action android:name="android.intent.action.MAIN" />
                   <category android:name="android.intent.category.LAUNCHER" />
               </intent-filter>
           </activity>
           <provider android:authorities="${applicationId}.fileOpener2.provider" android:exported="false" android:grantUriPermissions="true" android:name="io.github.pwlin.cordova.plugins.fileopener2.FileProvider">
               <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
           </provider>
       </application>
       <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
       <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
       <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
       <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   </manifest>`
   
   and also to add, I used the `cordova.file.externalRootDirectory` to save the file in the android device. I don't know yet if the fixed would work in the lower android API version up to 22.
   
   Special thanks to this thread: @rastafan @breautek @peterfox1 @HansKrywaa @hariagustian @eliadAfeka 


----------------------------------------------------------------
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