Cannot build android app after upgrading to ionic 3


#1

Hello,

I have upgraded ionic and cordova with npm install -g cordova ionic
Ionic version is "2.2.3"
Cordova version is “7.0.0”

After upgrading I am not able to build or generate APK for my apps.
Error logs:

ionic build android

> ionic-hello-world@0.0.0 ionic:build /data/Ionic/myApp
> ionic-app-scripts build

[14:28:50]  ionic-app-scripts 1.3.7 
[14:28:50]  build dev started ... 
[14:28:50]  clean started ... 
[14:28:50]  clean finished in 1 ms 
[14:28:50]  copy started ... 
[14:28:50]  transpile started ... 
[14:28:52]  transpile finished in 1.62 s 
[14:28:52]  preprocess started ... 
[14:28:52]  deeplinks started ... 
[14:28:52]  deeplinks finished in 6 ms 
[14:28:52]  preprocess finished in 7 ms 
[14:28:52]  webpack started ... 
[14:28:52]  copy finished in 1.75 s 
[14:28:57]  webpack finished in 5.26 s 
[14:28:57]  sass started ... 
[14:28:58]  sass finished in 646 ms 
[14:28:58]  postprocess started ... 
[14:28:58]  postprocess finished in 7 ms 
[14:28:58]  lint started ... 
[14:28:58]  build dev finished in 7.58 s 
[14:28:59]  lint finished in 1.06 s 
ANDROID_HOME=/data/Android/Sdk

JAVA_HOME=/data/java/jdk1.8.0_101

Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle 
in your path, or install Android Studio

Any solution for this problem?
Please help


#2

Remove the android platform and then add it again.
There are some problems with the new cordova cli 7.0


#3

Hi @LoLStats,

Thanks for the reply.

I have removed android platform and added it again, still got the same error.
I am facing this error for apps that I have created after upgrading to Ionic 3, Build is working for old apps that I have created previously.


#4

Issue resolved after adding environment variable: :grinning:

GRADLE_HOME=/xxx/xxx/android-studio/gradle/gradle-3.2
export GRADLE_HOME
PATH=$PATH:$GRADLE_HOME/bin; export PATH

#5

Hi there, Can you briefly describe how to enter environment variable. As m having same error and is unable to resolve. Thank you.


#6

you wanna add the above code as mentioned by @ankitrc012 in bash_profile.sh


#7

@TaimoorMughal,

you can add the environment variable from .bash_profile file.

vi ~/.bash_profile

add GRADLE_HOME and update your PATH variable as I have mentioned.
do source ~/.bash_profile


#8

Thank you for your help, found another solution too, you may use the platforms of the previous apps, mine error was related to platforms it wasn’t downloading the complete platform of android, so I used the previous app platform and it worked :slight_smile: :stuck_out_tongue: