简体   繁体   中英

unable to use path_provider in flutter

I am using path provider packager in my flutter app. 1. I added dependencies in my pubspec.yaml file 2. run flutter package get [No error here] 3. import packages

When I am trying to the app. it through the below error.

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

thanks in advance.

I hope this is helpful to you

In your pubspec.yaml file Add path_provider as a dependencies

sependencies:
  flutter:
    sdk: flutter
  path_provider:

and save it while importing the file use

import 'package:path_provider/path_provider.dart';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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