Android Networking - Part 2: The Starter App | Ray Wenderlich

Download the starter app, build it in Android Studio, and review the existing app code. Review the use of ViewModel, LiveData, and the Repository pattern.


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

Can’t compile this in Android Studio 3.2.1
Can anyone try this out from Download Materials?

The whole project keeps throwing me errors once I update my gradle as Android studio recommended

Hi @happiehappie. I downloaded the materials for this video, and opened the start folder in Android Studio 3.2.1. For some reason, Android Studio did not prompt me to upgrade the project Gradle plugin to 3.2.1 like it normally does. It proceeded with the Gradle sync, but that failed.

To fix this issue, whether prompted by Android Studio or not, make these manual changes in the following 2 files:

(1) project build.gradle file in the start folder: Change kotlin_version to 1.2.71 and Gradle plugin version to 3.2.1 in the classpath call. (Must have Kotlin plugin 1.2.71 or later installed).

(2) The file gradle-wrapper.properties in start/gradle/wrapper folder: Change Gradle version to 4.6 in the distributionUrl.

Then sync your Gradle files again. I was able to build and run the project in AS 3.2.1 after making these changes.

Let me know if those changes fix the issue you’re seeing. Thanks!

Sorry for the ongoing questions, I’m new to Android Studio(coming from Swift background) But after changing the kotlinversion and gradle version, I am greeted with this error
Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jre7:1.3.0

And yes my classpath is 3.2.1

I see, cause I changed kotlin version to 1.3.0
Can you guide me how to setup if I were to use the latest stable kotlin ver(being 1.3.0) at this point? Just wanna know, for knowledge purpose and all

You want to change this to:

org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0

That should solve your issue when you switch to 1.3.0. In fact, you should use jdk instead of jre in the Kotlin standard library dependency no matter which Kotlin version you are using, at least for Kotlin 1.2+.

any tips for gradle 5.0? Sorry for the ongoing question for the same topic :x

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @happiehappie. I’ve not upgraded yet to Gradle 5.0, but will do so soon and let you know what I find. Thank you!

You also may run into a compilation error with Picasso. There’s a line in the starter project that uses Picasso.with(context)

That method is no longer used by Picasso. It’s now
Picasso.get()
and the context is no longer passed in.

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]

Still waiting on updated files. I am unable to compile. This entire are was the main reason for me getting Raywenderlich, so if I am unable to compile and work along with the tutorials that’s a problem :frowning:

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @dizzy49, thanks for the question! There is an updated version of this course here:

https://www.raywenderlich.com/10376651-android-networking-fundamentals

Was your question on the older version of the course? If so, please check out the newer version, and let us know if you have any problems there. Thanks again!

@macsimus
I did not see that there was a newer version of the course. Site can be tricky navigating.
Thanks for this!