16. February 2020

Unable to upload Xamarin app with C/C++ code to Google Play – solution

After finishing release build of your Android application with Xamarin – Visual Studio 2019 you may experience the following error when uploading the app to Google Play Console:

Warning!
This release is not compliant with Google Play 64-bit requirement.

The following APKS or App Bundles are available to 64-bit devices, 
but they only have 32-bit native code: 1000.

Even when your application contains ARM and ARM64, it might still happen that Google refuses to accept your app and returns just the same error message.

The reason is simple: Google requires that your app with native code bundled as AAB (which is ZIP) contains also libraries for 64-bit platform. It does not matter which architecture.

The error is often caused by building application also for Intel platform because emulators on Intel are faster. There are two options to resolve the issue:

  • remove Intel platform from release build
  • add also 64-bit version for Intel platform to release build

Google is checking each platform and your .so files should be mirrored for 32-bit and 64-bit. If your bundle is not consistent then Google will refuse your application.

To fix this problem open Visual Studio 2019. Click your project in Solution Explorer. Open Properties (ALT+Enter).

Click Android Options, scroll down to Advanced button. Click Advanced button.

Uncheck all Intel platform (or check them all, based on your preference) and click Close.

Press CTRL+S to save changes. Create a new archive of your application (menu Build – Archive…)

Upload the new AAB.

If you don’t know how to switch to AAB, just go back to Android Options. Search for Android Package Format and select ‘bundle’.

26. December 2019

Build Installer for your Python application – PyInstaller

Do you have your Python application ready? Now it’s time to distribute it. The question is how to bundle it?

One way of bundling Python application into exe/binary file is to use PyInstaller.

You can do it using following commands:

pip install pyinstaller
pyinstaller file_with_main.py

The result will be stored in directory dist. The directory contains one build for the operating system that you’re running.

22. December 2019

Jenkins Generic Webhook Plugin failed with: Did not find any jobs with GenericTrigger configured

Generic Webhook Plugins allows invoking build of Jenkins job.

First of all, you need to set the token in job configuration.

Go to Build Triggers, check Generic Webhook Triggers.

Jenkins Build Trigger

Set Token e.g. to WEBHOOK-TOKEN.

Invoke curl:

curl http://localhost:8080/generic-webhook-trigger/invoke?token=WEBHOOK-TOKEN

It might happen that job build fails with the message:

{"jobs":null,
"message":"Did not find any jobs with GenericTrigger configured! 
If you are using a token, you need to pass it like ...trigger/invoke?token=TOKENHERE. 
If you are not using a token, you need to authenticate like 
http://user:passsword@jenkins/generic-webhook... "}

To fix the problem make sure that Trigger builds remotely is not checked in job configuration. The token set in this field has priority.

Once the duplicate token is removed the build should be possible to start.

19. December 2019

Install Jenkins by Helm to Kubernetes on Azure

Here you can find instructions for installing Jenkins on Kubernetes running on Microsoft Azure. The main advantage of deployment Jenkins on Kubernetes is the automatic scaling of agents.

How to do it?

First of all, you’ll need an account at portal.azure.com. Microsoft provides credit for new registration. If you have MSDN subscription you’ll get some credit which is available at portal my.visualstudio.com.

Software prerequisites:

  • Install Docker Desktop (not Desktop Enterprise). The installation also contains kubectl command from Kubernetes.
  • Install Helm.
  • Install Azure CLI.

Create Kubernetes infrastructure.

az aks create -n kube-jenkins --resource-group kube-jenkins-group \
  --node-count 1 --node-vm-size Standard_B2ms

Retrieve credentials for working with Kubernetes cluster on Azure.

az aks get-credentials -g kube-jenkins-group -n kube-jenkins

Switch to newly created Kubernetes.

kubectl config use-context kube-jenkins

Install Jenkins on Kubernetes by Helm.

helm install jenkins stable/jenkins

Retrieve password for admin user to login to Kubernetes.

printf $(kubectl get secret --namespace default jenkins \
  -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo

Create a tunnel from your computer to Kubernetes cluster. It will allow you to access port 8080 on localhost and the request will be forwarded to Jenkins on Kubernetes. With this command you do not need to install Ingress controller, so the setup is a little bit more secure than exposing Jenkins to internet.

export POD_NAME=$(kubectl get pods --namespace default \
  -l "app.kubernetes.io/component=jenkins-master" \
  -l "app.kubernetes.io/instance=jenkins" -o jsonpath="{.items[0].metadata.name}")
  echo http://127.0.0.1:8080
  kubectl --namespace default port-forward $POD_NAME 8080:8080

Go to web browser and type URL http://localhost:8080

Login is admin and password was retrieved by the command above.

If you’d like to remove Jenkins installation just type:

helm uninstall jenkins

5. December 2019

Helm 3.x fails with Error: must either provide a name or specify –generate-name

If you follow tutorials on using Helm, it might happen that they’re outdated, because they’re targeting Helm 2.x.

Following command for install will fail with error:

helm install -n aks-georgik-rocks aks-georgik-rocks-chart
Error: must either provide a name or specify --generate-name

The fix is simple. The syntax for helm 3.x is following:

helm install [NAME] [CHART] [flags]

Just remove -n. The command will look like this:

helm install aks-georgik-rocks aks-georgik-rocks-chart