错误:抖动中的downloads_path_provider

时间:2020-05-03 14:01:54

标签: flutter android-gradle-plugin build.gradle gradle-plugin

我正在使用This package来在android中获得良好的下载路径。 通过使用此程序包,我得到了/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或其他方法。

更新:我刚刚看到Repo of Downloads_path_provider上显示

此插件有很多不一致之处,不应再使用。随意进行分叉和调整。

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

2 个答案:

答案 0 :(得分:1)

代替使用ext_storage插件:

ExtStorage.getExternalStoragePublicDirectory(ExtStorage.DIRECTORY_DOWNLOADS);

我遇到了同样的问题并为我工作。

答案 1 :(得分:0)

您必须使用由Flutter提供的称为path_provide的官方程序包,并使用getDownloadsDirectory()方法来获取路径。