If you have a javascript UI and would like to create an APK for Android devices. Please advice how could i compile to get APK.
Use Cordova: cordova.apache.org
Just follow the steps for installation, turn your JavaScript project into a Cordova project with cordova run Android and then build the APK with cordova build android.
Related
I checked the documentation but didn't find a clear explanation about when to use those commands:
cordova platform add android && cordova run android
cordova prepare android && cordova run android
In the documentations the run command does this:
Run project (including prepare && compile)
run is already running prepare. So, is there any case where I need the option 2? To me it looks like it doesn't make sense if I'm using run after that.
Thank you in advance for your valuable time : )
Adding a platform in Cordova does not run the prepare command which will run hook scripts.
Assuming the android platform is not already added, this will generate the directory platforms/android and populate it with a complete standalone Android project. Cordova plugins that have been installed will also be installed into the Android project. cordova run android will run cordova prepare android followed by cordova build android, then proceed to install and run the application. If the android platform is already added Cordova will throw and error.
This command is redundant, and, assuming the android platform has already been added, will run cordova prepare android twice followed by cordova build android, then install and run that application. If the platform is not added Cordova will throw an error.
Conclusion
It makes little sense to differentiate between the two command sequences you provided as they seldom need to be executed. You usually only add a platform once, and you can just call cordova run android without needing to call cordova prepare android before it unless you intend to use cordova build android manually (potentially as a signed release) followed by using adb or saving/deploying the generated APK without needing to do a full blown run.
Regarding option 1, if you already have one android platform, it will fail due to
"cordova platform add android" command and not "cordova run android"
Regarding option 2, even if there is no android platform,it will work
Tried with cordova version = 10
Can I create Android applications with HTML5, CSS & JavaScript? Such as (News application, books library, 2D & 3D Games and etc) How can I do?
And what is the platform used?
A simple platform to use would be the cordova platform.
Simple tutorial found here: https://cordova.apache.org/docs/en/latest/guide/cli/
Install Cordova:
npm install -g cordova
Create project:
cordova create CordovaApp
Upon creating the application you will notice a 'www' folder. Inside you will find the html, css and js files and folders. Modify those according to your requirements
Add Target Device Platform:
cordova platform add ios
or
cordova platform add android
Build the app:
cordova build
Run the app:
cordova run android or cordova run ios
I would like to use the VuetifyJS/VueJS templates to build a Web app (PWA), Android app (Cordova) and Desktop app (Electron) from one codebase.
What is the best way to structure the main codebase to easily create the built for each platform?
Well, if you use Cordova you should place your build files in the dist folder, as you are used to. Then I do the following:
After Installing Cordova initialize in your project
cordova create mobile com.f1lt3r."${PWD##*/}"
cd mobile
Lets add the Android platform
cordova platform add android
This creates a mobile folder with the Cordova project in it. Next, create a symbolic link from your project build files to the Cordova web root.
cd ..
rm -rf mobile/www/*
ln -s $(pwd)/dist/* $(pwd)/mobile/www
Now, for Electron you could take a look at the config files of SimulatedGREG/electron-vue, I am not too familiar with this, but I think it would be possible to do something similar as with Cordova.
I Try To Build An Android App with JS
I Want To Build An Apk Of My HTML , CSS , JS Apllication
How Can I do ?
Note : i want Apk File For Android App Stores Not Only Mine
For a native way you should look at: Building Web Apps in WebView
For a framework way of building it look at:
Apache Cordova: http://cordova.apache.org
or Phone gap: http://phonegap.com
I'm trying to simulate my app on ios simulator with ionic. But when I run:
ionic build ios
ionic emulate ios
My app doesn't appear on the simulator. What should I do?
You need to install IOS-Sim tool.
The ios-sim tool is a command-line utility that launches an iOS application on the iOS Simulator.
Apply this command on terminal window:
$ sudo npm install ios-sim -g
Make sure that you have added the iOS platform to the project and verify that you have the iOS-Sim tool. If this is the problem you should a message that you are missing any of those two in the terminal.
if you are using visual studio, you need to configure the remote ios agent.
follow this documentation https://msdn.microsoft.com/library/dn757054.aspx#ios to configure and test you application
Sometimes, an ionic app can take a really long time to load on the simulator. First try waiting.
Second, if it still doesn't load, know that the simulator is a lot pickier about what it will run and not run than the browser. Check if you app works in the browser. Try a different browser (such as Firefox). If it does not, debug from there. If it does work in the browser, run your code through a linter to find that one semi-colon that your browser didn't care about.
Try start do it on xcode(in each my ionic/cordova project i have to use some native solutions to build application for iOS i use xcode for android i use android studio)
I know that different platform need some hours of adapt but this knowledge is very important
Try remove and add platform again.
ionic platform rm ios
and
ionic platform add ios
simply use following commands to build and run your ionic app respectively.
ionic cordova build ios
ionic cordova run ios