Android App crashes when calling mediaDevices.getUserMedia()

I am trying to use react-native-webrtc in an android app.

Whenever I call the method mediaDevices.getUserMedia(), the app immediately crashes on my Pixel 2 XL (real device) - no logs, error messages, just a full hard crash which results in me having to build the app again.

I am using RN v0.59.9

I have followed the installation instruction closely but use gradle wrapper 5.4.1:

distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip

Switching to the earlier version in the instructions throws this build error:

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from ‘12.0.1’.

I then also have to use:

classpath(“com.android.tools.build:gradle:3.4.1”)

Because if I use the recommended ones, I get this build error:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:@react-native-community_async-storage’.

Failed to notify project evaluation listener.
javax/xml/bind/annotation/XmlSchema

I also have to use:

buildToolsVersion = “28.0.3”
compileSdkVersion = 28

Because if I don’t I get the error:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:@react-native-community_async-storage’.

Failed to notify project evaluation listener.
Could not initialize class com.android.sdklib.repository.AndroidSdkHandler

Could it be that these settings are causing the package to crash when called, and if so, what can I do about it?

Thanks in advance.

The output suggests some problem related to the async storage library

I’m using it just fine, so I suggest you clean all gradle caches and try again, I’ve found it helps.

I deleted the cache ran npm install and now it’s working. 5 days lost.

Thank you.