Android: java.lang.NumberFormatException: For input string: "msf:56534"
See original GitHub issueDescription of the bug
NumberFormatException when picking up the file on Android
Reproduction steps
Exception during zip file picking from Downloads folder on Android and app crash right after it.
Code to repro
var fileTypes = NativeFilePicker.ConvertExtensionToFileType("zip");
NativeFilePicker.Permission permission = NativeFilePicker.PickFile((path) =>
{
if (path == null)
{
Debug.Log("Operation cancelled");
}
else
{
Debug.Log("Picked file: " + path);
// do stuff with file
}
}, new string[] { fileTypes });
Debug.Log("Permission result: " + permission);
Logs for the above
01-11 00:02:11.374 6678 6706 I Unity : Permission result: Granted
01-11 00:02:14.542 6678 6829 D Unity : Selected media uri: content://com.android.providers.downloads.documents/document/msf%3A56534
01-11 00:02:14.545 6678 6829 E Unity : Exception:
01-11 00:02:14.545 6678 6829 E Unity : java.lang.NumberFormatException: For input string: "msf:56534"
01-11 00:02:14.545 6678 6829 E Unity : at java.lang.Long.parseLong(Long.java:594)
01-11 00:02:14.545 6678 6829 E Unity : at java.lang.Long.valueOf(Long.java:808)
01-11 00:02:14.545 6678 6829 E Unity : at com.yasirkula.unity.NativeFilePickerUtils.GetPathFromURI(NativeFilePickerUtils.java:107)
01-11 00:02:14.545 6678 6829 E Unity : at com.yasirkula.unity.NativeFilePickerPickResultOperation.getPathFromURI(NativeFilePickerPickResultOperation.java:126)
01-11 00:02:14.545 6678 6829 E Unity : at com.yasirkula.unity.NativeFilePickerPickResultOperation.execute(NativeFilePickerPickResultOperation.java:53)
01-11 00:02:14.545 6678 6829 E Unity : at com.yasirkula.unity.NativeFilePickerPickResultFragment$1.run(NativeFilePickerPickResultFragment.java:49)
01-11 00:02:14.545 6678 6829 E Unity : at java.lang.Thread.run(Thread.java:923)
Any suggestions? I think it worked before so maybe I just got a weird file?
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
How can I prevent java.lang.NumberFormatException
"N/A" is not an integer. It must throw NumberFormatException if you try to parse it to an integer. Check before parsing or handle...
Read more >[Solved] java.lang.NumberFormatException: For input string
This exception occurs when someone tries to convert a String into primitive data types such as int, float, double, long, byte, short, etc....
Read more >java.lang.numberformatexception for input string null
The java.lang.NumberFormatException comes when you try to parse a non-numeric String to a Number like Short, Integer, Float, Double etc.
Read more >How to Handle the NumberFormat Exception in Java
The NumberFormatException in Java is thrown when it is not possible to convert a string to a numeric type (e.g. int, float).
Read more >Cannot open DB Error: java.lang.NumberFormatException ...
Cannot open DB Error: java.lang.NumberFormatException: For input string: "2147483648" #9541. Open ... Caused by: java.lang.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It worked!! The same zip is now loaded, no problems. Thank you for help! I hope I helped at least a little with investigation 😃
Sure. Here is was I see extra on top of that exception above. Notice second stacktrace for “Animators may only be run on Looper threads”