2

I'm following the steps here to package my PWA to submit to the Play Store - https://docs.pwabuilder.com/jekyll/update/2018/02/03/how-to-package-android.html

When I get to this step: "In Android Studio, select Build > Build APK in the menu bar. The APKs are saved in projects/Polyfills/cordova/platforms/android/build/outputs/apk/"

I get the error:

Gradle version 2.2 is required. Current version is 4.4

I've checked gradle-wrapper.properties and I am using the right distribution URL: distributionUrl=https://services.gradle.org/distributions/gradle-2.2-all.zip

I am by no means a developer and completely new to Android Studio, so I'd appreciate any help (as descriptive as possible).

Abdul Kawee
  • 2,687
  • 1
  • 14
  • 26
  • 1
    please refer to this answer: https://stackoverflow.com/questions/34749299/gradle-version-2-2-is-required-current-version-is-2-10 – Faizal Abbas Sep 11 '18 at 10:02

2 Answers2

4

Use the following in project level build.gradle:

classpath 'com.android.tools.build:gradle:3.1.0'

Required Gradle version 4.4 is equivalent to Plugin version 3.1.0+, as per table below: enter image description here

For more details, kindly refer to https://developer.android.com/studio/releases/gradle-plugin

Jerry Chong
  • 7,954
  • 4
  • 45
  • 40
1

Change the gradle plugin version in your project level build.gradle file to 2.0.0 e.g:

classpath 'com.android.tools.build:gradle:2.0.0'   

and Invalidate and Restart Android studio.

Qasim
  • 5,181
  • 4
  • 30
  • 51
  • Thank you. When doing that I'm then notified Gradle version 2.10 is required. If I then update the disributionUrl to 'gradle-2.10-all.zip', I then get another message to say that is an unsupported version as well. (invalidating and restarting in between) – digitalrichard Sep 17 '18 at 12:48