无法使用Dagger2注入改造RestAdapter

时间:2015-10-06 09:29:55

标签: android dependency-injection retrofit dagger-2

我在我的应用程序中使用Dagger2进行DI。我创建了AppModule类,其中包含提供注入和AppComponents类的方法。一切运作良好,但在提供改造RestAdapter的方法包括后,我有以下错误:

D:\project\app\src\main\java\com\example\android\app\MyApp.java:5: error: cannot find symbol
import com.example.android.app.di.components.DaggerAppComponent;
                                             ^
  symbol:   class DaggerAppComponent       
  location: package com.example.android.app.di.components
D:\project\app\src\main\java\com\example\android\app\di\components\AppComponent.java:7: error: cannot find symbol
import retrofit.RestAdapter;               
               ^                           
  symbol:   class RestAdapter              
  location: package retrofit               
D:\project\app\src\main\java\com\example\android\app\di\components\AppComponent.java:22: error: cannot find symbol
  RestAdapter restAdapter();               
  ^                                        
  symbol:   class RestAdapter              
  location: interface AppComponent         
D:\project\app\src\main\java\com\example\android\app\di\modules\AppModule.java:8: error: cannot find symbol
import retrofit.RestAdapter;               
               ^                           
  symbol:   class RestAdapter              
  location: package retrofit               
D:\project\app\src\main\java\com\example\android\app\di\modules\AppModule.java:35: error: cannot find symbol
  public RestAdapter provideRestAdapter() {
         ^                                 
  symbol:   class RestAdapter              
  location: class AppModule                
D:\project\app\src\main\java\com\example\android\app\di\modules\AppModule.java:56: error: cannot find symbol
  public Object provideApiService(RestAdapter restAdapter) {
                                  ^        
  symbol:   class RestAdapter              
  location: class AppModule                
D:\project\app\src\main\java\com\example\android\app\di\modules\AppModule.java:15: error: dagger.internal.codegen.ComponentProcessor was unable to proce
ss this class because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
public class AppModule {                   
       ^                                   
D:\project\app\src\main\java\com\example\android\app\di\components\AppComponent.java:15: error: dagger.internal.codegen.ComponentProcessor was unable to
 process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
public interface AppComponent {            
       ^                                   
8 errors

0 个答案:

没有答案