ionic build android : No APK file generated in Ionic 2 - android

I just executed the command "ionic build android" on my ionic 2 project and it was done successfully it says. But there is no APK file generated. What am I supposed to do? Thanks in advance. I'm using node v6.11.2, Ionic CLI 3.7.0, cordova 7.0.1.

First create an account at ionic Io
than hit this ionic Io init in project directory
after login hit this ionic package build android
after successful your apk file store in your cloud and download it and install

The Path as mentioned before is the correct path to find your generated apk file.
yourProject/platforms/android/build/outputs/apk/android-rele‌​ase-unsigned.apk
Please check these steps if there something missing.
I. Development environment dependencies
1)You need at Least to download a java JDK 8
2)Download an Android SDK manager
3)you must Add them to the environment variables
(Windows)
i)Open environment variables
ii)ANDROID_HOME:create a new user variable with name ANDROID_HOME and add the path of the SDK manager
ex.C:\xxx\Android\sdk
iii)edit the user variable PATH value and add to it platform tools path ex. C:\xxx\Android\sdk\platform-tools
iV)JAVA_HOME:Don't forget also to edit in the user variable PATH, your old JAVA_HOME env path with the new JDK Path . ex.C:\Program Files\Java\jdk1.8.0_144
4)Globally install ionic and cordova
npm install -g ionic cordova
II. Ionic CLI for build android
5)ionic cordova platform add android
6)ionic cordova build android
N.B: there sometimes logging in issue through CLI when using this command, the next steps doesn't really make sense but it worked for me.
ionic config set backend pro -g
Retry the build process again ,if Still there a problem change to legacy and Then again back to pro
ionic config set backend legacy -g
ionic config set backend pro -g
It should work now, retry the build process again.
If still there a problem then make an app through the website of ionic
use this command with the --pro-id of your app and retry again.
ionic start --pro-id <ID>

Follow this steps
Run ionic cordova build --release android
Open android studio go to Build -> Generate Signed APK, press next
If you don't have Key store please create new one
Finish
you can find the APK under Platforms/android

Related

Run / Build Apk is not updated with the latest changes

I have a problem in my vuejs + cordova project, when there is an edit file for example (login.vue) the changes only appear when running the 'npm run serve' command but when running the command 'cordova run browser / android' the login.vue file is not updated. I've tried clear cache 'npm clear cache' and 'cordova clean / cordova prepare' the results are still the same.
Command Before run/build cordova :
npm run serve
npm run build
cd cordova_app
cordova run/build android or browser
it is because the latest changes you made to files need to be brought to the platform folder (E.g. $projectroot/platform/android/www).
For this you have two options:
you can edit the file here directly
$projectroot/platform/$platform_name/www, but as a result, if you delete the platform, then that change will get lost.
Or you can make also make the changes in $projectroot/www/ but you will need to run few commands: cordova platform remove android and cordova platform add android if it is for Android. Please note that this will also overwrite any special configuration you have made in your IDE (xCode for iOS or Android Studio for Android) because it regenerates from your code, a new workspace for your app to be compiled, including your latest code, all in the platform folder.
Good luck!

Cordova Project from Github

I m cloning a cordova app sourcecode from github. How do I install cordova and add android platform to it and build it in Android Studio?
After cloning the code, I am installing cordova, but cant add platform or anything related to cordova. Is there any tutorial on how to follow the correct steps to make it run in Android Studio? I am very new to Cordova. Thanks!
First of all: follow the GitHub repo's README and look for installation instructions.
To play around with a cordova app, you most definitely need the cordova CLI. If you haven't already, install NodeJS and npm from http://nodejs.org or using your package manager of choice. Then inside a terminal run
npm install -g cordova
(If you are using Linux you probably have to run that command with sudo)
Now you navigate into the cloned github repo and run
cordova platform add android
cordova build android
It will create a directory under ./platforms/android which you can open using Android Studio. Then you can run the app with an emulator or a connected device.
If at any point you receive error messages or you think something is missing, you can run (inside the GitHub cloned repo)
cordova requirements
It will show you if the cordova CLI is missing something. You will have to fix all the errors that come up. Consult the cordova documentation under https://cordova.apache.org/docs/en/latest/guide/cli/#installing-the-cordova-cli in order to do that.
Hope this helped.
Please note I am not a programmer . I am ex Banker and entrepreneur now .I got really frustrated while setting cordova with all those errors for building android apps in windows. Though, I now understand this is the simplest cake, if you know the know-how. I love coding, so I am sharing the whole length of steps . You can figure out what step you are missing.
Step 1. Requirements :
(a)node js ( npm )-- install it
(b) Install cordova by command -->
npm install -g cordova
(c) Install Phone gap by command --> npm
install -g phonegap
(d) Ant apache ( download bin not source ) by visiting
https://ant.apache.org/bindownload.cgi . Keep this in C:/ Program files
(e) JDK version 8 . you can down load previous version by visiting
oracle.com
NOTE : Keep ( ANT ) and JDK in Same Folder i.e extracted (d) and (e) in C:/Program files
Step: 2 Setting Environment Variables
you can visit : Control Panel\System and Security\System--> environment variables You can see two types of windows : User and System
User Environment Variables:
You have to set ANT_HOME and JAVA_HOME
Add new variable :
Variable name :ANT_ HOME
Variable value : C:\Program Files\apache-ant-1.10.3
Variable name :JAVA_ HOME
Variable value :C:\Program Files\Java\jdk1.8.0_172
System Environment Variables: edit path and at the end use ; and paste ant/bin address
PATH :
Variable name :path
Variable value :....C:\composer;C:\Program Files\Git\cmd;C:\Program Files\apache-ant-1.10.3\bin
NOTE : Check ant & java configuration by windows command prompt :
ant -version and java --version . If using git then git --version.
If you error free then proceed further.
Step 3. Create a cordova project
something like this command: cordova create hello com.example.hello HelloWorld
Step 4. create platform android or ios: ensure proper config.xml
**Step 5. now check cordova requirements: This work in app folder only **
Now build your app.
Other errors you get if you miss these:
check ="ANDROID_SUPPORT_VERSION" in config xml.
Add Required Plugin - cordova plugin add -- as you need in config.xml
Cordova requirements: This work in app folder only
Cant find the Ant Version: you have not used ANT_HOME, JAVA_HOME folder name.Ensure ANT_Home and JAVA_HOME only in User folder while the path in System Variable. Never use / " or ' in writing these variables.
"IF YOU DONT REQUIRE ANT AND GIT ---> Dont download it "
Hope this helps beginners and code layman like me.
Answered on: Android Studio project detected

Setting Android Home path in ionic framework

I want to run my ionic project in android device.So I ran following commands
Ionic add ionic-platform-web-client
ionic plugin add phonegap-plugin push
ionic io init
ionic platform add android
All the above commands were successfully executed.When I tried to run following command:
ionic run android
It gives me error:
'ANDROID_HOME' environment variable is set to non-existent path.
Try update it manually to point to valid SDK directory.
You may not have the required environment or OS to run this project.
How do i fix it now?
Try ionic build android before android run android
Just set you windows environment for the correct android home path

Can't build app with Ionic

I am no longer able to build my app and generate an apk anymore because an error shows up. Here is what happens when I try to build the app in the command prompt: Command Prompt
Can somebody please help me with this? Oh and this is what happens if I type ionic info in the command prompt:
Your environment has been set up for using Node.js 0.12.4 (x64) and npm.
C:\Users\Singh>ionic info
Your system information:
Cordova CLI: 5.1.1
Ionic CLI Version: 1.6.1
Ionic App Lib Version: 0.3.3
OS: Windows 7 SP1
Node Version: v0.12.4
C:\Users\Singh>
Try to remove the platform, and then add it again, and then build your application.
So, if you have android as targeted platform execute these commands:
ionic platform remove android
ionic platform add android
ionic build android
My son had a very similar problem, and we never did figure out what caused it. He ended up creating a brand new blank ionic project, and then just copying the www folder from the old project. It worked, and he was able to get things building again. If you try it, you'll also have to re-add your plugins, copy package.json and bower.json, and then rerun bower install and npm install. It's not pleasant, but it might be worth a shot if you're desperate.

How do I install Phonegap 3.3 on Windows

I just went to Phonegap and saw that I needed to install node.js to get started.
I did this, then followed the command line to install phonegap.
However, where is it? I don't see anything in my program files folder, I don't see Eclipse, and there's no documentation on what to do next on Phonegap's website. I don't understand why this instruction is so vague? What am I missing? And where did all those files I downloaded/installed go go?
Thanks
Phonegap 3.3 installation there is no proper info in phonegap site.
The reason of installing nodejs is, phonegap cordova are created as node modules.
Required Software’s:
Follow the steps. 1 Node Js 2 ANT 3 Android_sdk 4 JDK
open command prompt:
Follow the steps
C:\user\youruser>npm install -g phonegap
C:\user\youruser>npm install -g cordova
Set Environment variables:
Mycomputer -> Right Click -> properties -> Advance System settings -> Environment
variables
set path for 1. Java JDK 2. Android SDK 3. ANT
C:\user\youruser>cordova platform add android
C:\user\youruser>phonegap create First-app
C:\user\youruser>cd First-app
C:\user\youruser>phonegap run android
Phonegap will be installed and apk will be created in bin folder.
You will be getting
[phonegap] detecting Android SDK environment..
[phonegap] using the local environment
[phonegap] compiling Android...
[phonegap] successfully compiled Android app
[phonegap] trying to install app onto device
[phonegap] successfully installed onto device
You can able to see phonegap modules in C:\Users\yourusername\AppData\Roaming\npm.
Hope this will be very helpful. Let me know if you face any issues.
Phonegap installation steps present on the official site are somewhat vaguely presented and hasn't been properly updated.
With respect to your question, I think this post https://stackoverflow.com/a/18751002/4277415 might help you out.
Cheers.
Install phonegap without any error : http://www.markupjavascript.com/2014/07/installing-phonegap-in-windows.html

Categories

Resources