2
Following the documentation, should be two simple commands:
- To include the platform:
ionic platform ios android
- To compile:
ionic build android
However, I’m getting a lot of red error on the terminal, as shown below:
Edited so far: I solved part of the problem, however, I’m with new mistakes:
Following the tips, I unzipped the Android JDK in the folder /usr/local
.
And include at the end of the file ~/.profile
the lines below:
export ANDROID_HOME=/usr/local/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Then I executed the command: source ~/.profile
And then I executed the commands below:
echo >> /.profile
echo "export ANDROID_HOME=/usr/local/android-sdk-linux" >> /.profile
echo "export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" >> /.profile
. /.profile
I followed a few steps through of this reference:
And now it’s displaying the following error:
➜ TesteApp ionic build android
Running command: /var/www/html/apps/TesteApp/hooks/after_prepare/010_add_platform_class.js /var/www/html/apps/TesteApp
add to body class: platform-android
Running command: /var/www/html/apps/TesteApp/platforms/android/cordova/build
[Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running:
You will require:
1. "SDK Platform" for android-22
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
ERROR building one of the platforms: Error: /var/www/html/apps/TesteApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /var/www/html/apps/TesteApp/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
I also ran the commands to install android-22:
cordova platforms remove android
cordova platforms add [email protected]
And I got the following message:
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.ionicframework.ionicgooglemap340659
Name: TesteApp
Activity: MainActivity
Android target: android-22
Copying template files...
Android project created with [email protected]
Running command: /var/www/html/apps/TesteApp/hooks/after_prepare/010_add_platform_class.js /var/www/html/apps/TesteApp
add to body class: platform-android
But when I execute the command ionic build android
, still shows the same error.
What needs to be done to make it work without errors, I already have Java JDK installed, need to do some more JAVA configuration?
I get the same mistakes. You have to see that there.
– Diego Souza
You have installed the Android SDK ?
– Lucas Fontes Gaspareto
No, you need to install?
– Ivan Ferrer
I haven’t tested with Android yet. Only iOS.
– Diego Souza
No doubt need to install and do not have to set any path for application, have to set the path to sdk.
– Lucas Fontes Gaspareto
As @devgaspa said, you need the android and java SDK.
– DiegoAugusto
In this Tutorial in English it teaches to mount the linux environment for only Cordova so start from the Install Java it teaches to install all dependencies to generate android APK(Java, Ant and Android SDK). Pay close attention and make sure you’re doing it right, mistakes when generating development environment are terribly terrible.
– Lucas Fontes Gaspareto
@Ivanferrer you installed these 3 items ? 1. "SDK Platform" for android-22 2. "Android SDK Platform-tools (Latest) 3. " Android SDK Build-tools" (Latest)
– Lucas Fontes Gaspareto
type android on the console, search API 22 and low, or if you prefer can change the version in the manifest file in the android folder of the application.
– henriquedpereira
Well, I downloaded from this link: http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz. and unzipped.
– Ivan Ferrer
is the main site of the Android JDK: http://developer.android.com/sdk/installing/index.html
– Ivan Ferrer