question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android: java.lang.NumberFormatException: For input string: "msf:56534"

See original GitHub issue

Description 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:closed
  • Created 2 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dzak83commented, Jan 15, 2022

lePicker/Android

It worked!! The same zip is now loaded, no problems. Thank you for help! I hope I helped at least a little with investigation 😃

1reaction
dzak83commented, Jan 14, 2022

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”

01-13 17:13:04.844  1031  1094 I CHRE    : @ 1926896.910: [NanoMinion] sent MSG Type 0x3, Version 0, 50 bytes, MessageId 255
01-13 17:13:04.844  1031  1094 I CHRE    : @ 1926896.911: [ChreWifiScanner] Requested active scan, interval: 120s, Max Age 20s
01-13 17:13:04.844  1031  1094 I CHRE    : @ 1926896.911: [ChreWifiScanner] active scan # 1086 started
01-13 17:13:06.050 20308 20633 D Unity   : Selected media uri: content://com.android.providers.downloads.documents/document/msf%3A56534
01-13 17:13:06.059 20308 20633 E Unity   : Exception:
01-13 17:13:06.059 20308 20633 E Unity   : java.lang.NumberFormatException: For input string: "msf:56534"
01-13 17:13:06.059 20308 20633 E Unity   : 	at java.lang.Long.parseLong(Long.java:594)
01-13 17:13:06.059 20308 20633 E Unity   : 	at java.lang.Long.valueOf(Long.java:808)
01-13 17:13:06.059 20308 20633 E Unity   : 	at com.yasirkula.unity.NativeFilePickerUtils.GetPathFromURI(NativeFilePickerUtils.java:107)
01-13 17:13:06.059 20308 20633 E Unity   : 	at com.yasirkula.unity.NativeFilePickerPickResultOperation.getPathFromURI(NativeFilePickerPickResultOperation.java:126)
01-13 17:13:06.059 20308 20633 E Unity   : 	at com.yasirkula.unity.NativeFilePickerPickResultOperation.execute(NativeFilePickerPickResultOperation.java:53)
01-13 17:13:06.059 20308 20633 E Unity   : 	at com.yasirkula.unity.NativeFilePickerPickResultFragment$1.run(NativeFilePickerPickResultFragment.java:49)
01-13 17:13:06.059 20308 20633 E Unity   : 	at java.lang.Thread.run(Thread.java:923)
01-13 17:13:06.086  5702 11093 I MediaProvider: Open with lower FS for /storage/emulated/0/Download/HomeData.zip. Uid: 10021
01-13 17:13:06.138 15646 15660 W System  : A resource failed to call release. 
01-13 17:13:06.157 20308 20632 E AndroidRuntime: FATAL EXCEPTION: Timer-0
01-13 17:13:06.157 20308 20632 E AndroidRuntime: Process: com.App, PID: 20308
01-13 17:13:06.157 20308 20632 E AndroidRuntime: android.util.AndroidRuntimeException: Animators may only be run on Looper threads
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at android.animation.AnimatorSet.pause(AnimatorSet.java:647)
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at android.graphics.drawable.AnimatedVectorDrawable$VectorDrawableAnimatorUI.pause(AnimatedVectorDrawable.java:1217)
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at android.graphics.drawable.AnimatedVectorDrawable.setVisible(AnimatedVectorDrawable.java:492)
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at android.widget.ProgressBar.swapCurrentDrawable(ProgressBar.java:691)
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at android.widget.ProgressBar.setIndeterminate(ProgressBar.java:679)
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at com.yasirkula.unity.NativeFilePickerPickResultFragment$3.run(NativeFilePickerPickResultFragment.java:133)
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at java.util.TimerThread.mainLoop(Timer.java:562)
01-13 17:13:06.157 20308 20632 E AndroidRuntime: 	at java.util.TimerThread.run(Timer.java:512)
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found