Retrofit 2 example tutorial but GsonConverterFactory display error "Cannot resolve symbol"
EDIT
retrofit 2 is now stable. Use
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
in your build.gradle
dependency section
old answer
with Retrofit 2.0 you have to declare in your build.gradle the convert factory you want to use. Add
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
to your gradle and sync it again
From another article on that site
Retrofit 2 doesn’t ship with Gson by default. Before, you didn’t need to worry about any integrated converter and you could use Gson out of the box. This library change affects your app and you need to import a converter as a sibling package as well. We’ll touch the converter later within this post and show you how to config the Gson or any other response converter for your app.
Thus, add this to your build.gradle
dependencies {
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
}
The reason to such behavior in my case was typo in build.gradle
dependency.
After beta4
release I've updated from:
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
to
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta4'
and the right dependency was
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
Also worth notice, that beta4 - retrofit won't work with beta2 - gson!