dagger

Injecting Androidx Fragments using Dagger 2

隐身守侯 提交于 2020-01-03 07:06:08
问题 I want to inject my Androidx fragments using dagger 2. In my activity I have: public class MainActivity extends AppCompatActivity implements HasSupportFragmentInjector { @Inject Reposetory reposetory; @Inject DispatchingAndroidInjector<androidx.fragment.app.Fragment> dispatchingAndroidInjector; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public AndroidInjector<androidx.fragment.app

flink - using dagger injections - not serializable?

三世轮回 提交于 2020-01-01 02:56:12
问题 Im using Flink (latest via git) to stream from kafka to cassandra. To ease unit testing Im adding dependency injection via Dagger. The ObjectGraph seems to be setting itself up properly but the 'inner objects' are being flagged as 'not serializable' by Flink. If I include these objects directly they work - so what's the difference? Class in question implements MapFunction and @Inject a module for cassandra and one for reading config files. Is there a way to build this so I can use late

fragmentDispatchingAndroidInjector while using support fragments

霸气de小男生 提交于 2019-12-31 01:23:06
问题 I'm trying to create a simple dagger 2 application while using support v4 fragments. After I modified my application I got this strange compilation error Error:(35, 8) error: [dagger.android.AndroidInjector.inject(T)] java.util.Map<java.lang.Class<? extends android.support.v4.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends android.support.v4.app.Fragment>>> cannot be provided without an @Provides-annotated method. java.util.Map<java.lang.Class<? extends

How do I run annotation processing via maven 3.3?

余生颓废 提交于 2019-12-29 08:53:05
问题 For years, we've been running the maven-processor-plugin as a separate goal (using proc:none on maven-compiler-plugin). We are finally upgrading from maven 3.0.5 to the latest 3.3.3, and I see that the maven-processor-plugin basically looks dead. As far I a can tell, it has not been migrated out of google code. We're using annotation processing primarily to generate dagger classes. I can't remember the reasons, but at the time (in dagger-1), we got the impression it is better to do this

Does “Avoid dependency injection frameworks” in the Android Memory Guide apply to Dagger as well?

孤者浪人 提交于 2019-12-28 11:42:34
问题 So I have come across this best practices on Android articles on memory performance. http://developer.android.com/training/articles/memory.html They said Avoid dependency injection frameworks Using a dependency injection framework such as Guice or RoboGuice may be attractive because they can simplify the code you write and provide an adaptive environment that's useful for testing and other configuration changes. However, these frameworks tend to perform a lot of process initialization by

Not able to understand dagger dependency injection concepts - Dagger 2 on android [closed]

人走茶凉 提交于 2019-12-25 21:01:09
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I am trying to understand dagger2 and implement in my app. I have read a lot about its benefits. Unless and until I understand it completely, I cannot get the benefits of it in my app. I have understood @Module and @Inject. The one that confuses me is @Component. I have few

Activity graphs and non-found dependency

白昼怎懂夜的黑 提交于 2019-12-25 07:39:05
问题 I'm starting using the dagger, like it pretty much, but now facing some difficulties. My scenario is as follows: there's an activity and a dependency for it. Dependency is injected to the activity, and requires a reference to that activity. Just like this: public class MainActivity extends BaseActivity { @Inject ScbeHelper scbeHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... } } public class ScbeHelper { protected static final

adding kotlin-kapt cause of getting Can not resolve symbol DaggerApplicationComponent error

假如想象 提交于 2019-12-24 10:24:10
问题 I did not already have any problem with Dagger as far i don't add Realm in my project, after adding that on my project i expect i can build successful my project but i get this error now: Can not resolve symbol DaggerApplicationComponent i want to need Realm on my application and i can't remove that, but i dont get any other error on Logcat to know whats problem and i should be fix that and I'm not sure how can i resolve this problem when i have this lines in build.gradle i dont have problem

Android Studio Plugin Exception

﹥>﹥吖頭↗ 提交于 2019-12-24 06:18:16
问题 I am getting following Android Studio Plugin exception when trying to load project com.intellij.ide.plugins.PluginManager$StartupAbortedException: com.intellij.diagnostic.PluginException: TOPIC [Plugin: com.alayouni.ansiHighlight] This started after I included Dagger 2.11 and enable Annotation Processor and Invalidated cache and then restarted Android Studio, Now I can't load any Project and its ending up with this same exception. I tried: Clearing Project build folders Re-installing Android

Robolectric, Dagger and compile time $ModuleAdapter creation

限于喜欢 提交于 2019-12-24 02:38:07
问题 Following on from the other questions in my Android TDD series, I have managed to get as far as using Robolectric , Mockito , Maven and ABS to unit test my Android developments. Evidently, I am seemingly pushing my own knowledge boundaries but the Android CI dream is just too alluring. If you can assist with my next problem I would be very grateful, here it is; I am wanting to write an integration test case which takes my application's database from v1 to head. I am using Dagger for DI and to