Reputation: 505
I'm developing an app in Ionic 4, ubuntu 18 is my OS. now I want to publish the app on android
when I type: sudo ionic cordova build android --prod --release
I get the following error:
Android Studio project detected
ANDROID_HOME=/usr/lib/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle/bin/java"
studio
Could not find an installed version of Gradle either in Android Studio,
but I did install gradle:
myApp git:(master) ✗ gradle -v
Build time: 2019-02-08 19:00:10 UTC Revision: f02764e074c32ee8851a4e1877dd1fea8ffb7183
Kotlin DSL: 1.1.3 Kotlin: 1.3.20 Groovy: 2.5.4 Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018 JVM: 1.8.0_201 (Oracle Corporation 25.201-b09) OS: Linux 4.15.0-45-generic amd64
also inside my ~/.zshrc file has:
export ZSH="/home/itamar/.oh-my-zsh"
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export JAVA_HOME="/usr/lib/jvm/java-8-oracle/bin/java"
export PATH=$PATH:/opt/gradle/gradle-5.2/bin
Upvotes: 3
Views: 11145
Reputation: 24454
On [email protected] and above and SDK Tools 26.x.x you have to install gradle by your own or if gradle installed you have to make sure it is available from command line;
in my case I use windows so I have install gradle manually and extract the zip file in C drive and set the path C:\gradle-6.0\bin
check if gradle working
for Unix-based systems
$ sdk install gradle 6.0.1
for macOS you homebrew package manager
$ brew install gradle
the issue discussed here at github .
Upvotes: 3
Reputation: 2411
The first thing I would try is to run the command without sudo
so just run ionic cordova build android --prod --release
If that doesn't work try solution #2
What you want to do is download the gradle bundle from their website. Once you have downloaded the Gradle binaries you want to do the following:
cd $HOME/Android/Sdk/tools
gradle
cd ./gradle
ionic cordova build android --prod --release
Upvotes: 2