No matter how hard I tried and looked for solutions online, none of them worked. It’s strange because my old project is running fine, but when I tried to create a new project and run a basic counter app, it kept giving me an error. It’s really frustrating when something that should be simple becomes so complicated.
[!] Gradle threw an error while downloading artifacts from the network.
Retrying Gradle Build: #4, wait time: 800ms
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:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:169)
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'... 1,925ms
I tried to change the classpath
– it works in the old project!
classpath 'com.android.tools.build:gradle:7.3.0'
to
classpath 'com.android.tools.build:gradle:4.1.0'
also I tried
deleted the gradle-wrapper.jar
file and run – nothing works
downgrade the distributionUrl
in gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip
to
distributionUrl=https://services.gradle.org/distributions/gradle-7.2-all.zip
&
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all
I’m running the projects in VS-code
2
Answers
I have no idea why my project running after changing some Android files!
What I did!
build.gradle
to
to
buil.gradle
in app folderto
gradle-wrapper.properties
to
every
AndroidManifest.xml
fileto
Now I can run the projects without errors but I have quite curious to know why my projects running after changing these many things
Try using VPN.
Connect to the VPN then run your project, it may take a while as it the first time, I would also highly recommend that you run your project on a real phone, not on emulator.