Comments (7)
I think your suggestion has fixed my problem, crashes seem to have vanished recently, but I'm not completely sure yet, let me run it for a couple more days and I will write back
from unitynativegallery.
Which function do you use to access the file in ProcessSelectedFilePath? Also, does it say which Android versions this error occurs on?
from unitynativegallery.
The code on my side that triggers the exception:
FileStream selectedFile = File.Open(selectedFilePath, FileMode.Open);
Regarding versions I've checked about 20 stack traces and the versions seen were Android 5, 6 and 7.
And from what I see in the stack traces there are 2 flows that get to this point/exception:
- When the user dont have the permission initially, I ask for it, and then on "Update" after the permission flag is on I call "GetImageFromGallery"
- When the user has already given the permission in the past, so I simply call "GetImageFromGallery" directly
Obs: I'm rolling out a major update on my app (which includes adding your plugin), so if you need me to add any code/tests on the flow just let me know and I will do it, I will certainly release many new updates today and on the next days
from unitynativegallery.
You can try the following:
FileStream selectedFile = File.Open(selectedFilePath, FileMode.Open, FileAccess.Read);
Adding FileAccess.Read to File.Open helped me get rid of similar exceptions on a standalone Unity game in the past. Maybe the same applies to Android, as well.
P.S: Or you can try other functions like File.Copy and so on.
from unitynativegallery.
Thanks, I will try that!
from unitynativegallery.
I think it's solved! Thanks a lot!
from unitynativegallery.
You are welcome! Hope the issue is indeed solved for good.
from unitynativegallery.
Related Issues (20)
- Unity Android Playform Build 'UnauthorizedAccessException' cant read file path is denied HOT 2
- v1.7.9 ERROR com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable HOT 2
- VisionOS Support for VisionOSVideoComponent HOT 30
- Where does the screenshot go when using the editor?
- Unity 2023 support HOT 5
- When the Android phone pops up to confirm the authorization, click Allow and get stuck. HOT 10
- iOS Ad Privacy Manifest HOT 1
- Can't open *.heic files HOT 8
- DirectoryNotFoundException: Could not find a part of the path "/storage/emulated/0/Android/data HOT 2
- SaveAudioToGallery method is private HOT 1
- iOS GetImageFromGallery show all photos event if PHAuthorizationStatusLimited HOT 2
- Unable to Save Images/Videos (IOS) HOT 2
- How to disable permission request on launch and instead use Runtime permissions HOT 2
- Plugin is not working for android 13 and above HOT 4
- When I use the AR camera I can't use the method "GetImageFromGallery" to select the picture, and call back is null HOT 13
- Android14 with get permission READ_MEDIA_VISUAL_USER_SELECTED but not get picture when callback HOT 1
- Is there a way to browse and select images within Unity using UGUI without calling the native Android gallery? HOT 1
- if i pick a path from my gallery, serialize that, and then use LoadImageAtPath it said that the file path is not found. HOT 1
- if i pick a path from my gallery, serialize that, and then use LoadImageAtPath it said that the file path is not found. but if i use the google foto Instead it works HOT 20
- AndroidJavaException: java.lang.NoSuchFieldError: no "Z" field "GrantPersistableUriPermission" in class "Lcom/yasirkula/unity/NativeGalleryMediaPickerFragment;" or its superclasses HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unitynativegallery.