3

Я следую this tutorial и пробовал еще со многими, и всегда получаю ошибку: Cannot resolve symbol для RestAdapter. Так что я гугл и this SO question с ответом придумал которые говорят, чтобы включить compile 'com.squareup.retrofit:retrofit:1.9.0', которые у меня уже есть в моих Gradle зависимостей:Retrofit 1.9 RestAdapter не может разрешить Symbol в Android Studio

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.0.0' 

    compile 'com.squareup.retrofit:retrofit:1.9.0' //As you can see here 
    compile 'com.squareup.okhttp:okhttp:2.2.0' 
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2' 

} 

Это класс и методы вызова ошибки:

public class ServiceGenerator { 
    public static final String API_BASE_URL = "http://your.api-base.url"; 

    private static RestAdapter.Builder builder = new RestAdapter.Builder() 
      .setEndpoint(API_BASE_URL) 
      .setClient(new OkClient(new OkHttpClient())); 

    public static <S> S createService(Class<S> serviceClass) { 
     RestAdapter adapter = builder.build(); 
     return adapter.create(serviceClass); 
    } 
} 

ответ

0

Вам просто нужно до удалить ->compile 'com.squareup.retrofit: converter-gson: 2.0.0-beta2' из зависимостей в файл gradle.build.

Причина является то, что вы с помощью Дооснащаемый другой версии в то же время, которые являются 1,9 и 2.0, которые не будут работать.

Надеюсь, что это поможет вам и другим, и установите мой ответ так, как это проверено, чтобы другие могли получить помощь.