Build Ionic offline

I wanted to run my ionic app on android because I used native plugins. But I get a gradle download error. Since my internet connection is not that fast, I checked the gradle version my app uses in platforms/android/gradle/gradle-wrapper.properties. And Here is what I found:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

So I downloaded gradle-4.10.3-all.zip. I created a dists folder under wrapper, put it there and changed the distributionUrl to point to ./wrapper/dists/gradle-4.10.3-all.zip. But still when I run my app, it changes the distributionUrl and starts to download gradle again.

By the way, I am using ionic version 5.0.2.

So, please tell me a way to use an offline gradle to build android apps.