abdallah-odeh / flutter_file_downloader

A simple plugin that downloads files to downloads directory in all android versions
BSD 3-Clause "New" or "Revised" License
23 stars 9 forks source link

downloadFile error: PlatformException(Download file error, 400, null, null) #29

Closed tanojsaipraveen closed 1 year ago

tanojsaipraveen commented 1 year ago

Unable to download this url http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4

tanojsaipraveen commented 1 year ago

fff

abdallah-odeh commented 1 year ago

Hello @tanojsaipraveen

the URL you provided is http not https, and in order to use "not secure" URLs you need to add the usesCleartextTraffic="true" in your AndroidManifest.xml, like this:

<application
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
        android:usesCleartextTraffic="true" <== add this line
        android:label="flutter_file_downloader_example">
...
</application>

please let me know if you face any other issues, I tested it out, with and without the flag above; without it: returned same error you got with it, file is downloaded and I can play it from downloaded files

abdallah-odeh commented 1 year ago

Please feel free to reopen this issue if you have any other related issues

tanojsaipraveen commented 1 year ago

Thanks @abdallah-odeh Its working now

abdallah-odeh commented 1 year ago

That's great to hear, you are most welcome

tanojsaipraveen commented 12 months ago

I was getting this error when project is building

Note: C:\Users...\pub.dev\flutter_file_downloader-1.1.4\android\src\main\java\com\odehbros\flutter_file_downloader\permission\PermissionUtils.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:...\pub.dev\flutter_file_downloader-1.1.4\android\src\main\java\com\odehbros\flutter_file_downloader\MethodCallHandlerImpl.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

abdallah-odeh commented 11 months ago

It's a warning I guess not an error, the project still builds successfully right? I tried to figure out what the deprecated actually but couldn't find a clear parts of the code 😕 There is already an issue about this warning #8

tanojsaipraveen commented 11 months ago

Yes It was warning