- Home /
How to solve the error "Failed to store screen shot" in Android
I am currently developing a video game with Unity and reaches the point that my players can share images of their achievements.
At the time of testing the apk on my android device with this code:
public void Share(){
Application.CaptureScreenshot(Application.persistentDataPath + "/Screenshot.png");
//Next Actions here....
}
And the following error is displayed on the console (with debug "adb logcat -s Unity"):
I/Unity(4460):Filename:./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
I/Unity ( 4460):
E/Unity ( 4460): Failed to store screen shot
And why not be able to share their records :(
I wonder why my PC (where I work with Unity3d version 5) if I can perform the screen shots, but in my android device are not performed.
Answer by Dave-Carlile · Jul 31, 2015 at 09:36 PM
According to the CaptureScreenshot documentation, the filename is automatically appended to persistentDataPath
on mobile devices, so when you do the append yourself you end up with an invalid path.
Yes, that is it seems.But it does not assume that the Application.persistentDataPath entry gives me the right way to write files. I think that should work well without any problem.
Thank you very much !! . I did not understand your answer, excuse me.
Thank you!
I connected the phone to check what was the problem and I haven't noticed that I have the persistantDataPath twice
Your answer
![](https://koobas.hobune.stream/wayback/20220611233932im_/https://answers.unity.com/themes/thub/images/avi.jpg)