1

Im using dagger in android. in my module I have a method which has a Application dependency. the code below:

@Module
public class NetworkModule {

    @Provides
    public Drawable provideAppDrawable(Application application) {
        return ContextCompat.getDrawable(application, R.drawable.logo);
    }
}

but when I compile, I get the error above in title. an I missing something here?

AppComponent interface:

@Component(modules = {NetworkModule.class})
public interface AppComponent {

    void inject(AuthActivity authActivity);
}

Activity:

public class AuthActivity extends AppCompatActivity {

    private static final String TAG = "AuthActivity";

    @Inject
    Drawable logo;


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        AppComponent appComponent  = DaggerAppComponent.create();
        appComponent.inject(this);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_auth);
    }
}
mrzbn
  • 497
  • 1
  • 3
  • 15

0 Answers0