'How to solve Android Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid xxxxx (Thread-X)?

I'm using Opencv sdk for Android to develop a real time processing and matching.

The main Opencv traitment logic is in a JNI function.

The problem is that sometimes (just sometimes) my app crashes without error, so I ignored the problem until I'm done developing the algorithm.

I started investigating the error and it's definetly in the JNI part.

Here is the error I get in the Log

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 27424 (Thread-8)
A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0

I searched a lot in the internet and I found this solution

<activity
   android:hardwareAccelerated="false" />

It worked for 2 days and now I'm getting the same error back.

What's the problem and how can I solve it?

Any help would be appreciated and thank you in advance.

EDIT

I should add that my application take a reference image from gallery and compare it using Opencv with a real time image feed.

If I choose an image from gallery and the app crashes, that image won't work again and if I take a new image or an image that worked before, the app works fine.



Solution 1:[1]

I solved by

  1. Restarted my smartphone (physical device).

  2. If you are using Android Studio, then go to file --> Invalidate Cache & Restart.

Solution 2:[2]

If you are on android emulator try to [Cold Boot] it

Solution 3:[3]

This problem did occur to me, but the verified answer didn't help. Instead, the combination of the other answers in this thread did. In a nutshell, all I did was:

  1. Invalidating Android Studio's cache.

  2. Wiping the device's data and cold booting it.

Solution 4:[4]

In my case, I narrowed the problem down to loading an Admob ad in a fragment. but only when the screen rendered for the second time.

Example: I leave the screen, then I return back to the screen, via FragmentManager.

In any case, if it is adview, you can fix by turning off hardware acceleration in the AndroidManifest.xml, or even better, directly on the ad component itself:

val adRequest: AdRequest = AdRequest.Builder().build()
    // disable hardware acceleration on this view, as it was causing the screen to crash on reload.
    adView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
    adView.loadAd(adRequest)

It was a bit tricky narrowing it down to this, but I noticed this:

I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:204204100

right above the message

" Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 19705 (RenderThread), pid 19631"

Solution 5:[5]

The easiest way to fix this for me was to uninstall and reinstall the app.

Solution 6:[6]

In my case, I was using Macbook Pro with iPad as external screen (sidecar mode), when I started getting this on the emulator.

After disconnecting sidecar. Its working fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yunnosch
Solution 2 snersesyan
Solution 3 Vu Tuan Hung
Solution 4 ZygD
Solution 5
Solution 6 Rishabh876