Ionic package build android fails with android SDK error


I’m trying to do an ionic package build android and it all goes well until I go look at the project in the cloud dashboard, it says the build failed and the output gives me this error:

ANDROID_HOME=/opt/android-sdk JAVA_HOME=/usr/lib/jvm/java-8-oracle Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK. Looked here: /opt/android-sdk/tools/templates/gradle/wrapper

Here’s my ionic info:

cli packages: (/Users//dev//node_modules)

@ionic/cli-utils  : 1.8.1
ionic (Ionic CLI) : 3.8.1

global packages:

Cordova CLI : 6.5.0
Gulp CLI    : CLI version 3.9.1 Local version 3.9.1

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3 browser 4.1.0 ios 4.3.1
Ionic Framework    : ionic-angular 3.6.0


Android SDK Tools : 26.0.2
ios-deploy        : 1.9.1
ios-sim           : 5.0.13
Node              : v7.7.4
npm               : 2.15.12
OS                : macOS Sierra
Xcode             : Xcode 8.3.3 Build version 8E3004b

And my cordova requirements:

Requirements check results for android: Java JDK: installed 1.8.0 Android SDK: installed true Android target: installed android-26,android-25,android-24,android-23,android-22,android-21 Gradle: installed /Applications/Android

If you can, upgrade that to 7.0.1. This should sovle your problem.