Exception in thread “main” java.util.zip.ZipException: error in opening zip file – Getting error while switching from desktop mode to android mode?

I have created a project called myApp in Flutter in linux desktop mode. When I set up the project I had to go through some initial configuration like –

flutter channel dev
flutter upgrade
flutter config --enable-linux-desktop

I can successfully run the project on Linux environment. Now I want to test the same project on Android platform. I’m using the following command to run the app for Android.

flutter run -d vivo

But I’m getting the following error —

Launching lib/main.dart on vivo 1606 in debug mode...
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)                    
        at java.util.zip.ZipFile.<init>(ZipFile.java:219)               
        at java.util.zip.ZipFile.<init>(ZipFile.java:149)               
        at java.util.zip.ZipFile.<init>(ZipFile.java:163)               
        at org.gradle.wrapper.Install.unzip(Install.java:214)           
        at org.gradle.wrapper.Install.access$600(Install.java:27)       
        at org.gradle.wrapper.Install$1.call(Install.java:74)           
        at org.gradle.wrapper.Install$1.call(Install.java:48)           
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        at org.gradle.wrapper.Install.createDist(Install.java:48)       
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                         0.7s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)                    
        at java.util.zip.ZipFile.<init>(ZipFile.java:219)               
        at java.util.zip.ZipFile.<init>(ZipFile.java:149)               
        at java.util.zip.ZipFile.<init>(ZipFile.java:163)               
        at org.gradle.wrapper.Install.unzip(Install.java:214)           
        at org.gradle.wrapper.Install.access$600(Install.java:27)       
        at org.gradle.wrapper.Install$1.call(Install.java:74)           
        at org.gradle.wrapper.Install$1.call(Install.java:48)           
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        at org.gradle.wrapper.Install.createDist(Install.java:48)       
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                         0.5s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1

I have also tried chaning the config by the following command but still I’m getting the above error –

flutter config --enable-android
flutter run

Do I have to change the configuration in order to run the app on Android, or do I have to create a seperate project with same code for Android platform? Can anyone please shed some light on this? Following is my flutter doctor -v summary –

enter image description here

1 possible answer(s) on “Exception in thread “main” java.util.zip.ZipException: error in opening zip file – Getting error while switching from desktop mode to android mode?

  1. Hi @ssantanuberaa
    Either your Gradle hasn’t downloaded properly or is damaged
    Please try this solution

    This is just a common Gradle issue, not related to Flutter itself

    Closing, as this isn’t an issue with Flutter itself. If you disagree, please write in the comments and I will reopen it.
    Thank you