PokeAPI / pokekotlin

Kotlin (or Java, Scala, etc) client for PokeApi
Apache License 2.0
171 stars 43 forks source link

Instant crash using the Java example #61

Closed Vascosantos16 closed 5 years ago

Vascosantos16 commented 6 years ago

Hello!

I've been wanting to create a VGC companion app for quite a while and was thinking of doing so now.

I imported your API and tried your example code, but it instantly crashes with a network error.

Is there a fix for this? Because i can't find any.

PS: this happened on android studio.

tdmalone commented 6 years ago

Could you perhaps post the error? That might help with troubleshooting it ;)

Vascosantos16 commented 6 years ago

https://pastebin.com/Gc4ESjZv

here you go my dude.

Vascosantos16 commented 6 years ago

Any ideas?

ianbenkenobi commented 6 years ago

I have the exact same issue but in kotlin.

Yoduh commented 5 years ago

Networking operations can't be done on the main thread of your application. You have to run it in an AsyncTask and add a permission to the AndroidManifest.xml file see: https://stackoverflow.com/a/6343299