stephanenicolas / toothpick

A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.
Apache License 2.0
1.12k stars 115 forks source link

No factory could be found #401

Closed vovaksenov99 closed 4 years ago

vovaksenov99 commented 4 years ago

Proguard from here doesn't work for me https://github.com/stephanenicolas/toothpick/wiki/Proguard-&-TP#tp-3

Caused by: toothpick.locators.NoFactoryFoundException: No factory could be found for class f.a.c.a.s.a. Check that the class has either a @Inject annotated constructor or contains @Inject annotated members.

But proguard from this PR is fine https://github.com/stephanenicolas/toothpick/pull/376

Is this a mistake in wiki and I need proguard from PR?

I use the latest Toothpick version

dlemures commented 4 years ago

Hi @vovaksenov99 ,

Did you fix the issue? Could you update the ticket with more details?

vovaksenov99 commented 4 years ago

Yes. I did.

I used that proguard preferences.

-keepnames @toothpick.InjectConstructor class *
-keepclasseswithmembernames class * { @javax.inject.Inject <init>(...); }
-keep class javax.inject.**
-keep class javax.annotation.**
-keep class **__Factory { *; }
-keep class toothpick.** { *; }