Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

IllegalArgumentException on Huawei devices #496

Closed
aoershov opened this issue Mar 13, 2018 · 3 comments
Closed

IllegalArgumentException on Huawei devices #496

aoershov opened this issue Mar 13, 2018 · 3 comments

Comments

@aoershov
Copy link

aoershov commented Mar 13, 2018

Bug Information

Version Number of Plugin:
v3.0.1
Device Tested On:
Huawei CAM-L21 6.0
Version of VS:
15.6.1
Version of Xamarin:
4.9.0.749

Steps to reproduce the Behavior

Sometimes we get IllegalArgumentException to our exception tracking system from Huawei devices.
Stack trace is:

Java.Lang.RuntimeException: Failed to find configured root that contains /storage/F0E9-334E/Android/data/com.xxx.ct/files/Pictures/Sample/2018-03-04_050214.jpg
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8e5fb2e658ca42ca839e2014a199ee42>:0 
  at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in :0 
  at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in :0 
  at Android.Support.V4.Content.FileProvider.GetUriForFile (Android.Content.Context context, System.String authority, Java.IO.File file) [0x00077] in :0 
  at Plugin.Media.MediaPickerActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00264] in <49a52fb6256449a58ab50f1c23e53b55>:0 

Android manifest contains:

		<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
			<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
		</provider>

file_paths.xml:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-files-path name="my_images" path="Pictures" />
</paths>

It looks like known issue:
https://stackoverflow.com/questions/39895579/fileprovider-error-onhuawei-devices

Please consider adding workaround for Huawei devices to media plugin:
https://stackoverflow.com/a/41309223

bpater-tp pushed a commit to bpater-tp/MediaPlugin that referenced this issue Apr 23, 2018
Handle special Huawei devices
@DragonTM
Copy link

Could anybody clarify if the fix has been released? if yes in what version. I am facing the same issue.

@Mike-NotFound
Copy link

Mike-NotFound commented May 30, 2019

Just came across this today using 4.0.1.5 of the plugin.

Started to test my app on a couple of devices and got the "Unable to get file location this most likely means that the file provider information is not set in your android manifenst file" error on a Huawei phone running Android 7

Not a real problem for us as the app is for internal company use only and we don't have any Huawei company devices, this was a personal phone.

@pablortpo
Copy link

pablortpo commented Mar 26, 2020

hi guys,
actually i have also error whit Huaweii 9P Lite, the user go to open the camera, the app its crashed and it close.
tested in Xamarin forms: 4.2.0.848062
Device: Huaweii p9 lite.
Plugin: Xam.Plugin.Media 4.0.1.5

i think that this error it from provider Huaweii

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants