react-native-webview icon indicating copy to clipboard operation
react-native-webview copied to clipboard

Android crash after taking photo via <input type="file"> inside WebView

Open aravind3566 opened this issue 4 months ago • 6 comments

Bug description:

When HTML is used inside react-native-webview, choosing the camera, capturing a photo, and confirming cause the app to crash and restart on Android (observed on Samsung Tab A SM-T515 RAM 2GB). The crash happens right as control returns from the camera app to the WebView.

To Reproduce:

  1. Render a WebView that loads an HTML page containing .
  2. Tap the file input → choose Camera.
  3. Take a photo and tap OK / confirm.
  4. The app crashes and restarts instead of returning the selected image to the web page.

Expected behavior:

The WebView returns the captured image to the page and file selection completes without crashing.

Actual behavior:

Immediately after confirming the camera capture, the process is killed and the app restarts.

Logcat:

I ActivityManager: Killing 11681:com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0/u0a260i19 (adj 900): isolated not needed W ActivityManager: wait for provider publish: waiters=1 callerApp=ProcessRecord{3157b2c 9706:com.sec.android.app.camera/u0a75} cpr=ContentProviderRecord{7caad3b u0 com.app/com.reactnativecommunity.webview.RNCWebViewFileProvider} I ActivityManager: Start proc 12039:com.app/u0a260 for content provider {com.app/com.reactnativecommunity.webview.RNCWebViewFileProvider} W ActivityManager: Scheduling restart of crashed service com.samsung.klmsagent/.service.ProtectService in 1000ms for start-requested W ActivityManager: Scheduling restart of crashed service android/com.android.server.DrmEventService in 0ms for persistent E unknown:ReactHost: com.facebook.react.bridge.ReactNoCrashSoftException: ... Tried to access onActivityResult while context is not ready I WebViewFactory: Loading com.google.android.webview version 139.0.7258.94 (code 725809430) I chromium: ... variations_seed_loader.cc:67 Failed to open file for reading.: No such file or directory (2) W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.reactnativecommunity.webview.RNCWebViewManager

Environment:

  • OS version: One Ui 3.1 (Android 11)
  • Model - Samsung Tab A SM-T515 (only on RAM 2 GB version)
  • react-native version: 0.79.6
  • react-native-webview version: 13.15.0
  • Android WebView (from logs): 139.0.7258.94

aravind3566 avatar Aug 21 '25 04:08 aravind3566

Same issue with ios

Julienblc avatar Aug 27 '25 08:08 Julienblc

+1

FleeceWithFlower avatar Aug 30 '25 14:08 FleeceWithFlower

Hi @jamonholmgren , Kindly take a look.,

aravind3566 avatar Sep 01 '25 07:09 aravind3566

Hi, I had the same issue oniOS, and it turned out to be a permission problem.

/* my log */

This app has crashed because it attempted to access privacy-sensitive data without a usage description. 
The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

I solved it by referring to react-native-permissions

Added NSCameraUsageDescription in Info.plist

Updated the Podfile with:

setup_permissions([ ..., 'Camera' ])

After doing this, the crash was resolved.

this is related to permission handling not related to issue.,

aravind3566 avatar Sep 02 '25 04:09 aravind3566

+1

Priyansh-Kasera avatar Sep 09 '25 07:09 Priyansh-Kasera

+1 We've seen the same issue appear on very few Android devices.

thor010111 avatar Sep 30 '25 13:09 thor010111