Кажется, я не могу найти класс MyApplication
из моего ApplicationComponent:
И вывод этой ошибки:
ошибка: не удается найти класс символов MyApplication
Вот все связанные классы:
ApplicationComponent:
@ApplicationScope
@Component(modules = {ApplicationContextModule.class,
SharedPreferencesModule.class,
KeyStoreModule.class,
SharedPreferenceHelperModule.class,
StartModule.class,
AndroidInjectionModule.class,
BindModule.class,
AndroidSupportInjectionModule.class})
public interface ApplicationComponent {
void inject(MyApplication myApplication);
@Component.Builder
interface Builder {
@BindsInstance
Builder application(MyApplication myApplication); //CANT FIND MYAPPLICATION
ApplicationComponent build();
}
@ApplicationContext
Context getApplicationContext();
SharedPreferences getSharedPreferences();
KeyStoreServiceInterface getKeyStoreService();
SharedPreferencesHelper getSharedPreferencesHelper();
StartViewModelFactory getStartViewModelFactory();
}
Класс MyApplication:
public class MyApplication extends MultiDexApplication implements HasActivityInjector {
private ApplicationComponent applicationComponent;
@Inject
DispatchingAndroidInjector<Activity> dispatchingActivityInjector;
@Override
public void onCreate() {
super.onCreate();
applicationComponent = DaggerApplicationComponent.builder()
.applicationContextModule(new ApplicationContextModule(this))
.build();
DaggerApplicationComponent
.builder()
.build()
.inject(this); //ERROR HERE. Complains that there is no inject method, offers creation of one in ApplicationComponent, but already exists one.
}
@Override
public AndroidInjector<Activity> activityInjector() {
return dispatchingActivityInjector;
}
public ApplicationComponent getApplicationComponent() {
return applicationComponent;
}
}
А вот мой манифест:
<application
android:name="MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString">
<activity android:name="start.StartActivity" ></activity>
</application>
Почему он не распознает класс?