I'm working with geocoder. On all devices the code works fine but on a Nexus 5 phone there is an exception in the logs.
My code:
override fun fromAddress(address: Address): Observable<Geolocation> {
val location = geocoder.getFromLocationName("${address.street} ${address.number}, ${address.postcode}, ${address.city}", LOCATIONS_MAX_RESULTS).first()
return Observable.just(Geolocation(latitude = location.latitude, longitude = location.longitude))
}
My Error:
java.io.IOException: grpc failed
at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
at nl.ah.appienow.data.address.AndroidGeocoder.fromAddress(AndroidGeocoder.kt:20)
at nl.ah.appienow.address.ValidatePostcode$execute$1.apply(ValidatePostcode.kt:31)
at nl.ah.appienow.address.ValidatePostcode$execute$1.apply(ValidatePostcode.kt:17)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:121)
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:64)
at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:51)
at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:37)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:43)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
at io.reactivex.Observable.subscribe(Observable.java:10842)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:452)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I read everywhere the solution reinstall Android studio or update Android studio but this doesn't works for me.