![](/img/trans.png)
[英]Flutter - save file to download folder - downloads_path_provider
[英]Error: downloads_path_provider in flutter
我正在使用這個 package來獲取 android 中的下載路徑,效果很好。 通過使用這個 Package 我得到了我想要的/storage/emulated/0/Download
。
問題:當我運行flutter run --release
時會引發錯誤。
Launching lib\main.dart on SM J700F in release mode...
Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':downloads_path_provider:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\Sandeep Sharma\.gradle\caches\transforms-2\files-2.1\56f020e9c27d6a807cc1a74760f6e28d\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVa
riationSettings not found.
C:\Users\Sandeep Sharma\.gradle\caches\transforms-2\files-2.1\56f020e9c27d6a807cc1a74760f6e28d\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcInd
ex not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 34s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 158.0s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
The plugin cloud_firestore could not be built due to the issue above.
Running Gradle task 'assembleAarRelease'...
如果這無法解決,那么建議如何獲取此路徑/storage/emulated/0/Download
或其他方式。
更新:我剛剛看到了 Downloads_path_provider 的回購,上面寫着
此插件有很多不一致之處,不應再使用。 隨意分叉和調整它。
我應該使用什么來獲取此路徑/storage/emulated/0/Download
。 謝謝。
而是使用ext_storage插件:
ExtStorage.getExternalStoragePublicDirectory(ExtStorage.DIRECTORY_DOWNLOADS);
我有同樣的問題並為我工作。
您必須使用名為 path_provide 的 flutter 提供的官方package並使用getDownloadsDirectory()
方法獲取路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.