Android Networking - Part 12: Setting up Retrofit | Ray Wenderlich

Learn about how to setup the Retrofit library and Gson parsing library as dependencies for your Android project.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4539-android-networking/lessons/12

But you never show the source code here

Thanks video for the question! This part shows you how to setup the Retrofit and Gson dependencies in your build.gradle files, then gets you ready to use a Retrofit object in the next part. Could you clarify your question, in terms of which piece was missing? Thanks again!

Hi Macsimus, I downloaded the completed code for this section, refactored it to androidx and got it to run on the emulator, however I get "Error retrieving path: /users/w00tze/repos ::: Unable to resolve host “api.github.com”: No address associated with hostname
" and no repo is shown in the emulator, can you help me out ?

Hi @ahnset thank you for your question! I’m not sure why a change to AndroidX would cause an issue reaching the API. I suspect the issue is unrelated to the AndroidX refactor. Especially because the error you’re seeing is “No address associated with hostname”. Check to see if you made any other changes in the Retrofit code, or potentially update the app dependency to a newer version of Retrofit.

The good news is that we are currently preparing an updated version of this Android Networking course, one that will use an entirely different sample project that is already set up with AndroidX. That updated course will be available in about one month or so. Please check it out when it’s available.

Thanks again!

Got it, the new tutorial is welcome, in the mean time I will try to fix the error.

Thanks @macsimus !