无法在flutter中使用path_provider

时间:2018-06-28 11:15:35

标签: android dart flutter

我在flutter应用程序中使用路径提供程序打包程序。 1.我在pubspec.yaml文件中添加了依赖项 2.运行flutter包get [这里没有错误] 3.导入软件包

当我尝试使用该应用程序时。它通过以下错误。

PS C:\android-app\flutter-app-test\file_io> flutter run
Launching lib/main.dart on XT1706 in debug mode...
Initializing gradle...                                       4.5s
Resolving dependencies...                                   13.6s
Running 'gradlew assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':path_provider:platformAttrExtractor'.
> A failure occurred while executing com.android.build.gradle.internal.actionio
> A failure occurred while executing com.android.build.gradle.internal.actaons.AttrExtractor
> A failure occurred while executing com.android.build.gradle.internal.lctions.AttrExtractor                                                     deb.actions.AttrExtractor
error in opening zip file --                                          
> A failure occurred while executing com.android.build.gradle.internal.actions.AttrExtractor   
> error in opening zip file

提前谢谢。

1 个答案:

答案 0 :(得分:0)

我希望这对您有帮助

在pubspec.yaml文件中,将path_provider添加为依赖项

sependencies:
  flutter:
    sdk: flutter
  path_provider:

并保存 导入文件时使用

import 'package:path_provider/path_provider.dart';