i had build the ionic project (sample in 'www' folder) and run the sample in browser. but i need to convert the sample/project in to android app, and want to test that sample in my android phone. please provide what are all the software needed to do this and what are all the step by step procedure.
You will need the Android SDK to compile Android code. Set ANDROID_HOME environment variable to the SDK location.
On windows: set ANDROID_HOME=/path/to/sdk
From the command line, run the following command which generates an Android project:
ionic add platform android
Then build an apk file using this command:
ionic build android
Copy the apk to an Android device for testing.
The next step after starting an ionic project and building the app is deployment.
Make sure your device connected to your machine. Make sure android ionic support is enabled via $ionic platform add android. Check that android is supported via $ionic platform list.
Then build your app.
$ionic build android and run it $ionic run android
This should run to the connected device to test. You can also use emulators by adjusting the run syntax.
Related
I am new to Flutter developement.
I kept reading, understanding & following Flutter Documentation and has created my first flutter app in Android Studio IDE. It is working fine in android emulators.
Now I want to test application in iOS simulator but I don't know how to generate build for iOS.
Is it possible to generate .ipa through Android Studio IDE? If yes then how can I do that? Also I can not build .apk, what are the steps for that?
Thanks in Advance...
You can use
flutter build apk --release
flutter install
To build for iOS you need a Mac, because it depends on XCode to compile parts of the application.
You should first install X-Code and Android Studio (with Flutter settings and SDK enabled) on macOs, then copy your source code there and open with Android Studio.
After that run flutter clean, flutter packages get and flutter build ios commands in order.
If you have used some libraries that are not supported in iOS they must be omitted or replaced in the project (it can be determined by seeing the library's official page on pub.dev).
Then connect the iPhone to mac and if everything is OK it should be visible in device list section, finally press the Run button to finalize required dependencies by downloading from the internet.
I m new to cordova/ionic.
I have a cordova project which i want to run either on android device or emulator.
When i run the command : ionic cordova run android.
I get the following error :
Detected locally installed Ionic CLI, but it's too old--using global
CLI.
cordova platform add android --save Using cordova-fetch for cordova-android#7.0.0 Error: Failed to fetch platform
cordova-android#7.0.0 Probably this is either a connection problem, or
platform spec is incorrect. Check your connection and platform
name/version/URL. Error: cmd: Command failed with exit code 1 Error
output:
in the code platform android already exists, but when i check its version it i s, android~6.3.0.
I have tried a number of things to resolve it which includes, reinstalling cordova, android.
Can anyone have a solution for it.
The code was written around a year back and now i have all the latest versions installed in my system
Problem is android platform was not added properly. Therefore you have to add respective Android Platform into your Project.
Before adding run :
cordova platform remove android
After run :
cordova platform add android#6.0.0
if you develop on windows enviroment You can check the version of Android provided by Cordova under :
C:/Users/%USER%/.cordova/lib/npm-cache/cordova-android
You may also want to try adding --nofetch to the command, which will use the pre-7.x behavior. See Cordova 7 fails to add android platform
You can try it by firstly updating your android sdk manager with all the latest updates and also update its gradle. Then try to firstly remove the android platform using command
CORDOVA PLATFORM REM ANDROID
and then add android platform using command
CORDOVA PLATFORM ADD ANDROID.
Ionic with visual studio always give node.js not installed. Even when I am using Node.js (6.7.0). Which runs android from Node command prompt.
I want to add Windows platform to my ionic.
Typically, when you add windows as a platform in your ionic project and then build it, it creates a visual studio project in the directory which you can easily open by just clicking on it. At what stage are you getting this error and what is the exact error that you are getting?
I created Simple cordova project using visual studio. I want ask
How to convert, save to apk? I tryed to run relise device, didnt
work, the file don't created. Should I use build.phonegap.com? Its
free?
After adding the android platform successfully you can easily use the cli to build the apk with the following command
cordova build android
you can even run the application in an emulator or device connected to your pc via the command
cordova run android
if you prefer to manually copy the apk to your device and then install from there, you can find the apk under " \platforms\android\ant-build "
You can create the apk making a build using the cordova command line. You have to use this command inside your cordova app dir:
cordova build android
And after that look for you apk inside the android platform folder. Of course first you have to add the platform if you have not already done:
cordova platform add android
I hope this helps you!
I have created the project with cordova CLI but i do not know where i need to change and how to run the cordova android project with eclipse for each platform. Thanks for helping
Before run the android project inside your Cordova Project you should know these things.
If you are making any changes in the Cordova Project then first you need to prepare the cordova. use the command cordova prepare
Then it changed in your config.xml (for android) automatic as you added or any changes you made. Do not make any change in your android project which exist inside your Cordova project. You can only make change inside the www folder of your Cordova project. And after made changed you need to make cordova prepare every time.
After prepare the cordova you can run the android project on device or emulator. For this you make sure you have made the path of android sdk for platforms-tools and tools in your environment system. If you not configure this path and add this two path in system environment .
Now run the android project on device use command cordova run android and run on emulator use this command cordova emulate android.
And if want to run on eclipse then you should import this android project of your workspace in eclipse. But if you again made changes in your cordova project then need to delete and again import the android project this switching happened every time so better to run through CLI.
I hope you got all things
Sunil's answer is good. I would like to add logging using Android Debug Bridge(adb).You may want to run:
adb logcat on a seperate shell window for logs after running cordova run android you need when you run into errors.This will produce huge logs, so I would recommend using:
adb logcat|grep Cordova