简体   繁体   English

错误:flutter 中的 downloads_path_provider

[英]Error: downloads_path_provider in flutter

I m using This package to get download path in android which work well.我正在使用这个 package来获取 android 中的下载路径,效果很好。 By using this Package I get /storage/emulated/0/Download which I want.通过使用这个 Package 我得到了我想要的/storage/emulated/0/Download

Problem: When I ran flutter run --release it throws an error.问题:当我运行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'...

if This can't be solved then suggest being how to get this path /storage/emulated/0/Download or another way around.如果这无法解决,那么建议如何获取此路径/storage/emulated/0/Download或其他方式。

Update: I just saw Repo of Downloads_path_provider which says更新:我刚刚看到了 Downloads_path_provider 的回购,上面写着

This plugin has lots of inconsistencies and should no longer be used.此插件有很多不一致之处,不应再使用。 Feel free to fork and tweak it.随意分叉和调整它。

what should I use to get this path /storage/emulated/0/Download .我应该使用什么来获取此路径/storage/emulated/0/Download Thanks.谢谢。

instead use the ext_storage plugin:而是使用ext_storage插件:

ExtStorage.getExternalStoragePublicDirectory(ExtStorage.DIRECTORY_DOWNLOADS);

I had the same issue and worked for me.我有同样的问题并为我工作。

You have to use the official package provided by the flutter known as path_provide and use the getDownloadsDirectory() method to get the path.您必须使用名为 path_provide 的 flutter 提供的官方package并使用getDownloadsDirectory()方法获取路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM