Hey everybody,
I went trough about 20 stackoverflows to make sure my $ANDROID_HOME is correctly set.
Currently even after a reboot of my macbook a simple echo $ANDROID_HOME is showing the RIGHT location directly without any hazzle.
Strangely though the build command in ionic for my apk is failing with the following error:
id | 12
status | FAILED
platform | Android
mode | debug
profile | os_v1_cert
started | 2017-06-30T10:34:13.434Z
finished |
output:
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
The ANDROID_HOME mentioned in that error is not the right location and is not what echo $ANDROID_HOME is returning in my bash.
So for today I gave up searching and hope maybe someone here has some new ideas for me.
so I just removed Android Studio and installed it again.
now it works…
strange but still it works
Are you building on Ionic Package via ionic package
commands? Then your local paths don’t really matter. What exact command are you executing?
Please post your ionic info
output.
Hey thank you for your feedback, but as stated above: problem went away by reinstalling a fresh android studio
Yes, but this makes no sense if you are using ionic package
. Do you?
I’m happy that it works for you, but in the future that may not work if this was not the cause for the solution.
ok, here you go:
global packages:
@ionic/cli-utils : 1.4.0
Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-ionic-angular : 1.3.1
Ionic Framework : ionic-angular 3.4.0
System:
Node : v6.11.0
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10
and in regards to the ionic package:
yes, I did use that command (i dont know any other way
)
ionic package build android --profile mycertname
If you want to build locally, use ionic cordova build android
instead of the “remote” command for Ionic Package. ionic cordova run
for directly running it on a connected phone, ionic cordova emulate
to emulate on a local emulator. Easier than to download the apk manually…
Your ionic info
looks ok, but no Cordova or Android platform which is strange. Can you run ionic cordova platform list
and paste the output?
ok, thank you.
I went ahead and tried ionic cordova build android
which gave me the question if I want to install cordova, what I approved.
Then the build process went through successfully. APK was generated without any problems.
Here is my cordova platform list
cordova platform ls
Running command - done!
Installed platforms:
android 6.2.3
ios 4.4.0
Available platforms:
blackberry10 ~3.8.0 (deprecated)
browser ~4.1.0
osx ~4.0.1
webos ~3.7.0
1 Like
Ah, you were missing the Cordova plugin for Ionic CLI - that’s why it didn’t list the platforms. Makes sense, as for ionic package
cordova locally is never used so you didn’t get that prompt.
Great you got it working!