0

I imported a flutter project from GitHub. when I tried to run it I had this error(no errors in code). I could not figure out what this error is all about and I keep getting this error for every project which I import from GitHub.Please help me out!

This is the error:

Exception in thread "main" java.util.zip.ZipException: error in opening zip file.
Gradle threw an error while trying to update itself. Retrying the update...
Finished with error: Gradle task assembleDebug failed with exit code 1.
srikanth7785
  • 1,382
  • 1
  • 7
  • 22
Ganesh Sivakumar
  • 149
  • 1
  • 16
  • Make a new flutter project and copy lib folder contents from old project to your new project. It has worked on couple of occasion for me and it will work if that project has no changes on the android folder. You have to edit the imports and replace previous project name with your new project name. – Zero Live May 23 '20 at 14:23
  • @ZeroLive Ok thanks but how do I deal with it without creating a new project and importing the contents. Why does that error occur in the first place? – Ganesh Sivakumar May 23 '20 at 14:27
  • I think it occurs due to corrupted gradle files. I can't say for sure though. – Zero Live May 23 '20 at 14:36

1 Answers1

0

It's kinda common problem when you get a project from github and I solved it once with this answer.

Copy paste from there:

Open your Android Studio preferences(Command + ',') and go to Languages and Frameworks -> Dart

Check "Enable Dart support for the project your_project_name"

In "Dart SDK path" click in "…" and navigate to flutter SDK directory. Under that directory you'll find "bin/cache/dart-sdk". This is the dart sdk path you should use.

Click "Apply"

flutter packages get

flutter run

Lunedor
  • 1,410
  • 1
  • 14
  • 33