Building an Android (or iPhone) app with Angular is super simple. In this guide, I will take from you Angular to App Store in 10 easy steps.
Prerequisites
- Setup your platform: Android Studio or Mac Xcode
Build an Android app with Angular
Install Cordova = Open a command prompt and type npm install -g cordova
Create a project = Navigate to the directory where you wish to create your project and type cordova create getting-started-app
Add a platform = Navigate to the project directory and add a platform by typing cordova platform add android
Run your app = From the command line, type cordova run android
Build your Angular app = Navigate to your project directory and type ng build --prod
Copy your Angular app to Cordova = Navigate to the dist folder and copy the contents of the build to the Cordova www folder e.g. angular/dist/getting-started/*.*
to cordova/www/*.*
(delete anything already in the www folder).
Configure the project = Open www/index.html
in a text editor. Change <base href=“/”>
to <base href=“./”>
Run the app = From the command line, type cordova run android
Sometimes the emulator does not start automatically. If this happens manually launch the emulator via Android Studio. The menu item is Tools, AVD Manager
.
Sign your app = Before you can publish your app you will need to sign it. You can read more about that here.
Publish your app = To publish your app you will need a Google Play Developer Account. Sign up here.
2 thoughts on “How to build an Android app with Angular”
- shahidfoythis has been useful but it does not seem to allow me to run CRUD operations to a backend server. For example I have my angular app running on cordova and a backend app running on localhost:3000 it wont allow for queries to localhost:3000. is there a way to fix that?Reply
- Peter StroyevCould be CORS need to enable server to accept requests from the localhost