错误:downloads_path_provider处于颤动状态



我正在使用这个包来获得android中的下载路径,它运行良好。通过使用这个软件包,我得到了我想要的/storage/emulated/0/Download

问题:当我运行flutter run --release时,它抛出了一个错误。

Launching libmain.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:UsersSandeep Sharma.gradlecachestransforms-2files-2.156f020e9c27d6a807cc1a74760f6e28dcore-1.0.0resvaluesvalues.xml:57:5-88:25: AAPT: error: resource android:attr/fontVa
riationSettings not found.
C:UsersSandeep Sharma.gradlecachestransforms-2files-2.156f020e9c27d6a807cc1a74760f6e28dcore-1.0.0resvaluesvalues.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的Repo,上面写着

这个插件有很多不一致之处,不应该再使用了。随意拨叉和调整。

我应该使用什么来获取此路径/storage/emulated/0/Download。谢谢

使用ext_storage插件:

ExtStorage.getExternalStoragePublicDirectory(ExtStorage.DIRECTORY_DOWNLOADS);

我也有同样的问题,并为我工作。

您必须使用flutter提供的名为path_provide的官方包,并使用getDownloadsDirectory()方法来获取路径。

最新更新