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

19. September 2019

Xamarin Visual Studio – Error ADB0020 Android ABI mismatch

Following error message might pop-up when you to run Xamarin app on Android:

Error ADB0020: Android ABI mismatch. You are deploying an app supporting ‘armeabi-v7a’ ABIs to an incompatible device of ABI ‘x86’. You should either create an emulator matching one of your app’s ABIs or add ‘x86’ to the list of ABIs your app builds for.

Here is how you can resolve it.

In Solution Explorer select your project.

Right-click and select Properties or press Alt+Enter.

Select Android Options, scroll down. In right bottom corner click Advanced button.

From the drop down menu select desired architecture, e.g. x86_x64.

Note: After changing any checkbox it is necessary to wait a bit so that Visual Studio syncs the preferences.

Now you should be able to run the project.

24. July 2019

Creating Python virtualenv fails with error: Could not find a suitable TLS CA

You can create Python virtualenv using command:

virtualenv -p /usr/bin/python3 py-env3

You may encounter following strange error:

  Collecting setuptools
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels
...
OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /etc/ssl/certs/ca-certificates.crt
...
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 145, in apport_excepthook
    os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_virtualenv.1000.crash'

The error message is not very clear. Problem is caused by ca-certificates and it could be fixed by command:

sudo update-ca-certificates

3. July 2019

Android Studio: How to display compiler error output

When build in Android Studio fails with following error:

Compilation failed; see the compiler error output for details.

You can display error output by click on Toggle view icon on left side of Build panel.

Then you can walk through build errors and navigate to problematic parts of source code in Android Studio.

7. June 2019

How to solve Android Emulator java.io.FileNotFoundException open failed: EACCES (Permission denied)

Following error in Android application is very annoying and you may waste several hours by hunting the root cause:

D/file: java.io.FileNotFoundException: /storage/emulated/0/Download/20190604_084533.jpg: 
open failed: EACCES (Permission denied)

It might occur even when the manifest is correct and contains proper permission:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Here is sample code which will pass on file existence check, but the execution will fail on readBytes:

var file:File = File("/storage/emulated/0/Download/20190604_084533.jpg")
if (file.exists()) {
    val content:ByteArray;
    Log.d("file", "exist")
    try {
        content = f.readBytes()
     } catch (FileNotFoundException) {
        Log.d("file", e.toString())
     }

} else {
     Log.d("file", "does not exist")
}

To fix this problem it is necessary to go to Settings – Apps – My App – Permission.

Access to Storage is probably disabled. Tap Storage to enable it:

With enabled Storage option, the application was able to read the file.

To solve this problem in a proper way, it’s necessary to add a request for permission to the code. Here is a sample in Kotlin:

val MY_READ_EXTERNAL_REQUEST : Int = 1
if (checkSelfPermission(
    Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        requestPermissions(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), MY_READ_EXTERNAL_REQUEST)
}

You can find more details about requesting permissions in Android documentation.