-
-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] TakePhotoAsync - IllegalArgumentException: failed to find configured root #329
Comments
What is your package name? It must be set to something like "com.company.appname" Rest assured this works fine just try the samples. |
The package name is correct and exactly in the form 'com.company.appname'. The permissions should not be the issue. These are set (among others):
Like I said, it did work with Android API 23, but after upgrading to 25 it stopped, even though I followed the readme and add all extra settings. |
If you can create a small sample that I can reproduce send it my way to test out. |
I had the same problem. You need to change the file_paths.xml. It must read: instead of: <external-files-path ...> |
following +1 .same problem with target sdk 24 . works fine with 23 Java.Lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/MyProject.Android/files/Pictures/PhotoDirectory/pack001Carton00102_10_2017_065131.jpg\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0 \n at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in :0 \n at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <61dabd3f0b0446bc8b570d6071d995d7>:0 \n at Android.Support.V4.Content.FileProvider.GetUriForFile (Android.Content.Context context, System.String authority, Java.IO.File file) [0x00078] in <27c17fe440cf491ba8255bcefade6e02>:0 \n at Plugin.Media.MediaPickerActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00212] in C:\projects\mediaplugin\src\Media.Plugin.Android\MediaPickerActivity.cs:172 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <3fd174ff54b146228c505f23cf75ce71>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <3fd174ff54b146228c505f23cf75ce71>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <3fd174ff54b146228c505f23cf75ce71>:0 \n at System.Runtime.CompilerServices.TaskAwaiter |
Can't reproduce |
Have you read my comment? Sorry, it got corrupted somehow. It should've read: I had the same problem. You need to change the file_paths.xml. It must read: <external-path ...> instead of: <external-files-path ...> At least that works for me... |
@obartelt can you copy and paste your full file_paths.xml in here? |
@jamesmontemagno sure, here you go:
|
Yeah, that one doesn't work anymore you need to update the scheme to the new way I have documented. You don't need to specify the full path, that is probalby why it didn't work. |
Hmm, I think you got me wrong here. The way you documented doesn't work ("external-files-path" instead of "external-path"). I tried all different kinds of solutions (full path, no full path, different prefixes, etc.), but the one I posted is the only one that worked for me. |
could just depend on your settings, if you look at my sample works just fine. https://github.com/jamesmontemagno/MediaPlugin/blob/master/tests/MediaAndroidTest/Resources/xml/file_paths.xml |
As long as you have it working that is good :) |
Yeah, definitely ;-) But your sample isn't working for me. Maybe device specific? I have a Honor 9... That whole Android fragmentation is really killing me ;-) |
I have the same problem on Huawei device |
why is this issue closed? The issue seems to be specfic to some huawei devices that have an sd card. In my case, its a p8 lite 2017. We don't seem to have a fix for this, because i think this should be fixed in the plugin. If you take a look at the comment of @Milena23 , it contains a link to a stackoverflow post about the issue. Right now, i don't seem to have a way to fix the issue, as the fix suggested by @obartelt breaks the plugin for other devices Edit: it turns out the fix to have it work on both Huawei and non-huawei devices, i needed to change my file_paths.xml to:
so i changed two things.
This seems to be the only way to make it work. Maybe it's a good idea to update the readme and example to match this, so the plugin actually works on all devices external-files-path to external-path |
@PaulVrugt is that so? I haven't had any complaints yet, but who knows how users use the app? ;-) |
@obartelt see my updated comment. I've posted an example of the xml that seems to work for all devices |
@PaulVrugt thanks, but that seems to be exactly what I have, and what I posted here on Oct 3/5 2017? |
Right, now that i read it for the 3rd time I see you are correct. The discussion between you and jamesmontemagno seemed to go specifically about the external-files-path and external-path, and there was no more mentioning about the full path after jamesmontemagno stated you shouldn't use the full path. That's why I didn't understand that this was necessary. Anyway, good for you that you're already using the method I (and apparently you too ;) ) posted, since this seems to work on all devices. @jamesmontemagno , this confirms that this seems to be the only working way. Probably a good idea to update the documentation, or provide us with an alternative solution. |
Hey James,
I'm running into issues with the TakePhotoAsync method.
They don't occur on iOS, nor on Android with Target SDK 23.
Note: all 'MY_PACKAGE_NAME' found below are actually containing the correct package. ;)
I've read both:
Bug Information
Version Number of Plugin: 2.6.2
Device Tested On: Samsung S8 (Android 7.0), iPhone 5s
Simulator Tested On: n.a.
Version of VS: Visual Studio 2017 15.3
Version of Xamarin: 2.3.4.267
Versions of other things you are using: Plugin.Permissions 1.2.1
Steps to reproduce the Behavior
Everything should be setup as described in the readme:
Create a view and view model where the view model holds an ICommand to handle, e.g. a button click.
Call the TakePhotoAsync in the handler.
Expected Behavior
The camera dialog will be opened and allows you to take a picture.
Actual Behavior
An exception is thrown:
Java.Lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/MY_PACKAGE_NAME/files/Pictures/IMG_20170823_130231.jpg
The 'Pictures' folder was created, both on the internal and external storage. There's just no image.
Code snippet
The text was updated successfully, but these errors were encountered: