我正在使用Android Studio 2.2.3而我正在努力让Retrofit在Android Studio中运行。我已将此添加到与项目关联的build.gradle中:
compile 'com.squareup.retrofit2:retrofit:2.1.0'
一切都将建立,但当我尝试实际使用Retrofit时,无法识别库。我尝试执行“与Gradle文件同步项目”以及从终端运行gradlew clean。这些都没有任何影响。
答案 0 :(得分:0)
我试过,它运行正常,你可以尝试修改你的gradle中的高版本的compileVersion,buildtoolsVersion,也许它会起作用。
答案 1 :(得分:0)
尝试使用这些依赖项
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
答案 2 :(得分:0)
问题变得非常简单。我正在为模块而不是应用程序的pom.xml添加行。将它们添加到应用程序的pom.xml中,它按预期工作。