How to build an APK for my Ionic Angular project?

236 views Asked by At

I am working on an Ionic Angular project and I need to build an APK file to distribute my app to Android devices. I have tried researching and following various tutorials, but I'm still facing some difficulties. Could someone please guide me through the process of building an APK for my Ionic Angular project?

ionic capacitor add android

ionic : File C:\Users\team\AppData\Roaming\npm\ionic.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1

  • ionic capacitor add android
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    
1

There are 1 answers

0
iammohansharma On

First of all you have to set _Execution_Policies

Just Open powershell in administrative mode and run the following command

"Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted"

Then

  1. add android (npx cap add android)
  2. build .www folder (ionic build)
  3. sync you project (npx cap sync android)
  4. open android studio ( npx cap open android )

In android Studio go to build and click (APK)

Hope this will work