简体   繁体   中英

Using dagger 2 in stand alone android library project

I am trying to create a stand alone library and use dagger 2 in it, I already create the module and the component of the library, and make the initialisation of the library including the dagger component, my goal here is I wanted this library can be used even the project who implemented it did not use dagger. but it seems my configuration only can work if the project implemented it, also use dagger2 cause I got error:

Application does not implement dagger.android.HasDispatchingActivityInjector

So are there anyway I can still dagger2 in my library without having the project who implemented it also use dagger2?

ps: My library contain an activity

It was because of missing android:name key with the value of my Application subclass to my manifest file .

Eg: Add android:name=". MyApplication " in your manifest under application tag. Change the 'MyApplication' to the name of your application class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM