Android运行异常,看了一天了。。。

06-07 17:12:42.750: E/AndroidRuntime(2237): FATAL EXCEPTION: AsyncTask #3
06-07 17:12:42.750: E/AndroidRuntime(2237): Process: com.example.clonetelegram, PID: 2237
06-07 17:12:42.750: E/AndroidRuntime(2237): java.lang.RuntimeException: An error occured while executing doInBackground()
06-07 17:12:42.750: E/AndroidRuntime(2237): at android.os.AsyncTask$3.done(AsyncTask.java:300)
06-07 17:12:42.750: E/AndroidRuntime(2237): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
06-07 17:12:42.750: E/AndroidRuntime(2237): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
06-07 17:12:42.750: E/AndroidRuntime(2237): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
06-07 17:12:42.750: E/AndroidRuntime(2237): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
06-07 17:12:42.750: E/AndroidRuntime(2237): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
06-07 17:12:42.750: E/AndroidRuntime(2237): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
06-07 17:12:42.750: E/AndroidRuntime(2237): at java.lang.Thread.run(Thread.java:841)
06-07 17:12:42.750: E/AndroidRuntime(2237): Caused by: java.lang.NullPointerException
06-07 17:12:42.750: E/AndroidRuntime(2237): at com.example.rr.DownLoaderTask.download(DownLoaderTask.java:81)
06-07 17:12:42.750: E/AndroidRuntime(2237): at com.example.rr.DownLoaderTask.doInBackground(DownLoaderTask.java:73)
06-07 17:12:42.750: E/AndroidRuntime(2237): at com.example.rr.DownLoaderTask.doInBackground(DownLoaderTask.java:1)
06-07 17:12:42.750: E/AndroidRuntime(2237): at android.os.AsyncTask$2.call(AsyncTask.java:288)
06-07 17:12:42.750: E/AndroidRuntime(2237): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-07 17:12:42.750: E/AndroidRuntime(2237): ... 4 more

8个回答

DownLoaderTask.java:81 你这一行报空指针

Caused by: java.lang.NullPointerException空指针异常啊

你这个报错是源自于异步加载的空指针吗?

如果是异步加载的话,有没有通过 Handler 把你的数据调用到主线程上,或者把通过UIThread 把数据绑定到控件上

doInBackground方法里有一个空指针
06-07 17:12:42.750: E/AndroidRuntime(2237): Caused by: java.lang.NullPointerException
06-07 17:12:42.750: E/AndroidRuntime(2237): at com.example.rr.DownLoaderTask.download(DownLoaderTask.java:81)

异步线程不能操作主线程

06-07 17:12:42.750: E/AndroidRuntime(2237): Caused by: java.lang.NullPointerException
06-07 17:12:42.750: E/AndroidRuntime(2237): at com.example.rr.DownLoaderTask.download(DownLoaderTask.java:81)

空指针异常

解决了,网址问题~~

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐