wangchenyan/lrcview

loadLrcByUrl方法异常

Closed this issue · 4 comments

使用loadLrcByUrl方法报出异常,歌词url可正常访问,异常如下:

2019-10-22 15:45:13.139 5643-5712/cn.whiteink.musicpartnerapp E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: cn.whiteink.musicpartnerapp, PID: 5643
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:318)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
     Caused by: java.lang.NegativeArraySizeException: -1
        at me.wcy.lrcview.LrcUtils.getContentFromNetwork(LrcUtils.java:154)
        at me.wcy.lrcview.LrcView$4.doInBackground(LrcView.java:354)
        at me.wcy.lrcview.LrcView$4.doInBackground(LrcView.java:351)
        at android.os.AsyncTask$2.call(AsyncTask.java:304)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
        at java.lang.Thread.run(Thread.java:761) 

@15050050972 你好,麻烦贴一下歌词url

@wangchenyan 歌词文件暂时失效了,我是使用的记事本直接粘贴的歌词,是不是记事本的编码问题

@15050050972 你好,2.1.2 版本已经修复该问题。
新增方法 loadLrcByUrl(String lrcUrl, String charset),如果中文出现乱码,需要设置编码。