SeismicGames / NDownloader

Native iOS/Android downloader for Unity
MIT License
8 stars 1 forks source link

FormatException: Input string was not in the correct format #10

Open natsupy opened 6 years ago

natsupy commented 6 years ago

Hi there, when I tried on the Android build, get this issue, using unity 2018.2.6f1, so what was I mistaken, can you help?

FormatException: Input string was not in the correct format System.Int64.Parse (System.String s) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int64.cs:461) DownloadManager.TrackDownloadIds (System.String[] ids) (at F:/GITHUB/NDownloader-master/Assets/NDownloader/Scripts/DownloadManager.cs:228) DownloaderExample.OnDownloadIdChanged (.DownloadRequest req, System.String downloadId) (at F:/GITHUB/NDownloader-master/Assets/Example/Scripts/DownloaderExample.cs:83) DownloadManager.OnDownloadIdChanged (.DownloadRequest req, System.String downloadId) (at F:/GITHUB/NDownloader-master/Assets/NDownloader/Scripts/DownloadManager.cs:267) DownloadRequest.set_DownloadId (System.String value) (at F:/GITHUB/NDownloader-master/Assets/NDownloader/Scripts/DownloadRequest.cs:66) DownloadRequest+<VerifyOrDownloadFile>c__Iterator0.MoveNext () (at F:/GITHUB/NDownloader-master/Assets/NDownloader/Scripts/DownloadRequest.cs:116) UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) DownloaderExample:Start() (at F:/GITHUB/NDownloader-master/Assets/Example/Scripts/DownloaderExample.cs:34)

keith-miller commented 6 years ago

@jayd16 any ideas?

jayd16 commented 6 years ago

Could you reply with the value that's failing to parse, @natsupy? Maybe Android changed the id format they use and we can't assume longs anymore.

natsupy commented 6 years ago

Hi, seems the id debugged is null, there is my apk build, include lunar console, which can show Debug.Log() https://mega.nz/#!SDIlVKjL!dM8dh5mUbqaB3Fg0ZFDRSo5n1U3GbmtcG891mJcTmf0

jayd16 commented 6 years ago

Ah ok. The issue was that Unity is returning empty string when a pref key doesn't exist instead of null. Wonder if this is a recent change. Anyway, the exact exception should be fixed.

The bad news is that it looks like the notification code is using old APIs now so I'll have to take a look at that.

Anyway @natsupy, try the latest.

natsupy commented 6 years ago

thank you, now I can see IDs but the progress always is 0, btw I customized the Manifest file, add the line "xmlns:tools="http://schemas.android.com/tools" under "xmlns:android="http://schemas.android.com/apk/res/android" after getting build error, dunno what was I wrong again, lol