diff --git a/app/src/main/java/com/emanuelef/remote_capture/Utils.java b/app/src/main/java/com/emanuelef/remote_capture/Utils.java
index 8923156f..7e5d5c10 100644
--- a/app/src/main/java/com/emanuelef/remote_capture/Utils.java
+++ b/app/src/main/java/com/emanuelef/remote_capture/Utils.java
@@ -803,9 +803,16 @@ public class Utils {
}
} catch (Exception ignored) {}
- Uri newUri = context.getContentResolver().insert(externalUri, values);
- Log.d(TAG, "getDownloadsUri: new file " + newUri);
- return newUri;
+ try {
+ Uri newUri = context.getContentResolver().insert(externalUri, values);
+ Log.d(TAG, "getDownloadsUri: new file " + newUri);
+ return newUri;
+ } catch (Exception e) {
+ // On some devices, it may trigger "IllegalArgumentException: Volume external_primary not found"
+ Log.e(TAG, "getDownloadsUri failed:" + e.getMessage());
+ Utils.showToastLong(context, R.string.write_ext_storage_failed);
+ return(null);
+ }
}
public static boolean isRootAvailable() {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 27bb7dbb..0f7af2f5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -453,4 +453,5 @@
Dump packets in the pcapng dump format, which allows embedding TLS decryption secrets
Sort by
Total bytes
+ Write to external storage failed. Check the app log for details