2016-12-15 132 views
0

我更新Android studio到最新版本的gradle版本2.2後出現問題*。我用匕首2 rxjava改造而發生的面對這個問題:更新2時出現錯誤:java.lang.NoSuchMethodError:com.google.gson.Gson.newJsonReader更新gradle後

E/AndroidRuntime: FATAL EXCEPTION: RxCachedThreadScheduler-1 
       Process: com.appsmedia.blaan2, PID: 19224 
       java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread. 
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:62) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at java.lang.Thread.run(Thread.java:841) 
       Caused by: java.lang.NoSuchMethodError: com.google.gson.Gson.newJsonReader 
        at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:35) 
        at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:25) 
        at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:116) 
        at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:211) 
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:174) 
        at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:171) 
        at rx.internal.operators.OperatorSubscribeOn$1$1$1.request(OperatorSubscribeOn.java:80) 
        at rx.Subscriber.setProducer(Subscriber.java:211) 
        at rx.internal.operators.OperatorSubscribeOn$1$1.setProducer(OperatorSubscribeOn.java:76) 
        at rx.Subscriber.setProducer(Subscriber.java:205) 
        at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152) 
        at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138) 
        at rx.Observable$2.call(Observable.java:233) 
        at rx.Observable$2.call(Observable.java:225) 
        at rx.Observable.unsafeSubscribe(Observable.java:8741) 
        at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94) 
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)  
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)  
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)  
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)  
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  
        at java.lang.Thread.run(Thread.java:841)  
+0

你使用的是什麼版本的gson?看起來它正在嘗試運行2.3或更早的版本。 – iagreen

+0

謝謝@iagreen,真的,我確實將改造版本更改爲最新版本,現在一切正常 –

回答

0

(發佈代表OP)的

將改造版本更改爲最新版本解決了我的問題。