dagger-2

java.lang.IllegalStateException: endPosTable already set

雨燕双飞 提交于 2019-12-30 07:58:11
问题 Trying to build an alexa (amazon:echo) skills set. At the same time, trying to use this experience as a learning testbed for dependency injection through dagger 2. However, building the package using maven-2 cmd: mvn assembly:assembly -DdescriptorId=jar-with-dependencies package'. to generate a zip jar with the complete dependencies produces the following exception trace: [INFO] ------------------------------------------------------------------------ [INFO] Building Echo Device Client 1.0

java.lang.IllegalStateException: endPosTable already set

我怕爱的太早我们不能终老 提交于 2019-12-30 07:58:07
问题 Trying to build an alexa (amazon:echo) skills set. At the same time, trying to use this experience as a learning testbed for dependency injection through dagger 2. However, building the package using maven-2 cmd: mvn assembly:assembly -DdescriptorId=jar-with-dependencies package'. to generate a zip jar with the complete dependencies produces the following exception trace: [INFO] ------------------------------------------------------------------------ [INFO] Building Echo Device Client 1.0

java.lang.IllegalStateException: endPosTable already set

自古美人都是妖i 提交于 2019-12-30 07:58:03
问题 Trying to build an alexa (amazon:echo) skills set. At the same time, trying to use this experience as a learning testbed for dependency injection through dagger 2. However, building the package using maven-2 cmd: mvn assembly:assembly -DdescriptorId=jar-with-dependencies package'. to generate a zip jar with the complete dependencies produces the following exception trace: [INFO] ------------------------------------------------------------------------ [INFO] Building Echo Device Client 1.0

Why can't dagger process these kotlin generics?

一世执手 提交于 2019-12-29 07:43:11
问题 I'm having some weird kotlin generic issues with Dagger that I kinda fixed but the solution isn't sound. Here's the dagger classes: @Module class P5Module { @Provides fun pool(): RecyclerView.RecycledViewPool = RecyclerView.RecycledViewPool() @Provides fun adapters(fusion: P5FusionAdapter, personas: P5ListAdapter, skills: P5SkillsAdapter, info: InfoAdapter) : List<Pageable> = listOf(fusion, personas, skills, info) } @ActivityScope @Subcomponent(modules = arrayOf(P5Module::class)) interface

Dagger 2 Named cannot be provided without a @Provides method

☆樱花仙子☆ 提交于 2019-12-29 07:32:10
问题 Trying to grok Dagger 2 and having an issue with named providers. I have a simple setup as follows: // Module @Module class AppModule(private val app: App) { @Provides @AppScope fun providesApp() = app @Provides @AppScope fun provideSharedPreferences(app: App) = PreferenceManager.getDefaultSharedPreferences(app) @Provides @AppScope @Named("Uri1") fun providesUri1() = Uri.Builder().scheme("https").authority("authory1").build() @Provides @AppScope @Named("Uri2") fun providesUri2() = Uri.Builder

What determines the lifecycle of a component (object graph) in Dagger 2?

空扰寡人 提交于 2019-12-28 01:38:43
问题 I'm trying to wrap my head around scopes in Dagger 2, specifically the lifecycle of scoped graphs. How do you create a component that will be cleaned up when you leave the scope. In the case of an Android application, using Dagger 1.x you generally have a root scope at the application level which you'd extend to create a child scope at the activity level. public class MyActivity { private ObjectGraph mGraph; public void onCreate() { mGraph = ((MyApp) getApplicationContext()) .getObjectGraph()

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

Two @Injects in one object but from two different Components

北城以北 提交于 2019-12-25 08:25:27
问题 I have: @Inject AdalService adalService; @Inject Realm realm; Both of these come from two different Components. AdalComponent @UserScope @Component(dependencies = {NetComponent.class}, modules = AdalServiceModule.class) public interface AdalServiceComponent { void inject(MainActivity activity); void inject(EventsJob eventsJob); } RealmComponent @UserScope @Subcomponent(modules = RealmModule.class) public interface RealmComponent { void inject(EventsJob eventsJob); } But I get the following

Dagger2 + Mockito: How to Unit Test this scenario?

时光怂恿深爱的人放手 提交于 2019-12-25 07:59:29
问题 I'm working on a team project which has a very coupled code. I'm trying to increase the unit test coverage and I've faced the following scenario: class Foo { static void methodA () { Bar b = new Bar(); b.getContent(); } } class Bar { @Inject DBAcessor mDBAcessor; Bar () { Dagger2.getInjector().inject(this); } public Object getContent() { mDBAcessor.fetchData(); } } I want to unit test methodA() , however I don't know if it is possible to do it without passing the DBAcessor object via

Multi-layer / libraries architecture with dagger2: designing scopes, components, modules

不想你离开。 提交于 2019-12-25 06:36:14
问题 I'm using dagger 2 in a multi-layered , multi-library Android SDK project. I'm developing many different libraries on different layers (data, business logic, presentation etc...) and using dagger to glue them together. My most important requirement is that each library of the architecture should be usable stand-alone (with its dependent components) and that a developer should decide to build on top on any layer he wants: for example: rewrite all the presentation layer using everything below