Ionic build in Azure pipeline - ionic-framework

I have a build server running the latest version of Visual Studio build agent (as of May 2020) in order to build (CI/CD) my Ionic Android app. I installed Ionic by doing (from Administrator account):
npm install -g #ionic/cli
Then I want to build the apk by doing
ionic cordova build android --prod --release
However, the build agent runs as NETWORK SERVICE and can in turn not find "ionic" program and therefore fails to build. The ionic program seems to be located in my Administrator's AppData. How can I install the necessary toolchain so it can be accessed/run by the Visual Studio agent? Same goes for the jarsigner and zipalign program (these however should be in Program Files so I guess these will be no problem to find for the NETWORK SERVICE).
I thought supplying the -g parameter would install it globally somehow but Ionic still resides in my users AppData. I have tried running it both elevated and not elevated. I am running on Windows Server 2019. Logging in to the server with my Administrator account and run the build command above from that account works fine.

Related

BuildFailedException: Failed to export self-signing certificate for appx Package

I am building a small app for Hololens 2. When I choose "Build And Run" in Unity, it makes it close to the end, but I get this error:
BuildFailedException: Failed to export self-signing certificate for appx Package.
Output:System.Security.Cryptography.CryptographicException: Input data cannot be coded as a valid certificate. ---> System.Security.Cryptography.CryptographicException: Input data cannot be coded as a valid certificate.
Here are my build settings:
Other settings:
Unity 2019.4.14f1
Visual Studio Community 2019 16.8.2
What I have tried:
generating a certificate with a password
generating a certificate without a password
executable only build type
D3D Project build type
restarting Unity
installing the certificate on my machine
restarting my computer
Using "Build" instead of "Build And Run". This results in "Build succeeded".
Switching to ARM architecture instead of ARM64
Following deployment instructions at https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/BuildAndDeploy.html
What do I need to change to get this to deploy successfully?
To fix:
Uninstall all Visual Studio stuff. Visual Studio, Build tools, everything.
Reinstall Visual studio following these instructions: https://learn.microsoft.com/en-us/windows/mixed-reality/develop/install-the-tools?tabs=unity
Install a few additional packages. Visual Studio Installer -> Modify -> Individual Components tab, find "C++ Universal Windows Platform support for v142 build tools (ARM 64)" and "C++ (v142) Universal Windows Platform tools", and select "Modify" in the bottom right.
After that I was able to deploy the package to the Hololens, using the D3D build type and a new build folder.

flutter debug APK not installing on mobile

Am not able to install the APK in my mobile generated by gradle. it's working fine on an emulator but when I try to install on my mobile its starts installing and in the middle, it gives the error APK not installed. Am running android 10. Paths from where I picked the debug APKs are as follow.
<project>/build/app/outputs/apk/debug/app-debug.apk
<project>/build/app/outputs/apk/debug/app.apk
<project>/build/app/outputs/flutter-apk/app-debug.apk
It seems your apk does not have certificate yet.
you cant install it just like that. you can either certify it build release android app
or set your phone to install app form unknown source. in app settings or security settings
If you're trying to manually install the app-debug.apk, you should rather consider generating app-release.apk but if you can't debug the app, then you might considering opening up your developer options.

Export AOSP emulator files after build

After a successful build of the AOSP using a non GUI server run's Ubuntu, I want to download the files to my mac or windows and run it on the Android Studio emulator or any other emulator.
What files do I have to download and how to run it on my mac ?
Download link:https://source.android.com/setup/build/downloading
Build link: https://source.android.com/setup/build/building
after building source code successfully, run the below command:
emulator -verbose -show-kernel

Easiest way to install the Ionic android app I created on a mobile

On this website (https://ionicframework.com/docs/intro/deploying/) I read that I should give this command on the command prompt: ionic cordova run android --prod --release
I tried it but it only tried to start the app on an emulator (I have some problems with it, so it didn't actually start the emulator). Does this command also create a file I can put on my mobile and install the app? I don't want to put the app on Google play, just on my mobile.
I tried putting the android-debug.apk on my mobile and running it but my mobile couldn't install it (.../platforms/android/build/outputs/apk/android-debug.apk)
I'm not trying to test the app on my mobile, I'm trying to install it.
If you want to deploy the apk to your device
ionic cordova run android --device is indeed correct. (try adding --device)
You only need --prod --release when building for production (longer buildtime).
Before running (= building, installing and starting your app) check if your device has USB-debugging enabled. You can check if your device is connected by running adb devices. Since the run command includes building, yes run should create a apk for you.
As you said you also could install the apk manually. Here make sure to use the correct apk. android-debug.apk is the development build (no --release tag) and since your trying to run a production one (--release) you are looking for android-release.apk or android-release-unsigned.apk.
go to settings -> security in your phone then check Unknown sources (Allow installation of apps from sources other than the play store) and try to put the android-debug.apk again. this should work

Ionic - build differences

I'm building project (android .apk files) on two different machines.
As long as i am updating aplication (on smartphone) from apk made on same machine as installed version it is ok. When im trying to update by apk file from other machine it fails - installation is not successful.
What may cause the problem?
Both machines has the same ionic, cordova and ionic-app-lib version.