question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dagger not generating Proguard/R8 rules with option experimentalUseStringKeys

See original GitHub issue

I’m having some issues with experimentalUseStringKeys on Android Studio 3.4 (beta 3). When running the app (release build with R8) it throws the following exception:

 java.lang.IllegalArgumentException: No injector factory bound for Class<Alb>

When adding the following to my Proguard rules manually the exception does not occur anymore:

-identifiernamestring class dagger.android.internal.AndroidInjectionKeys {
  java.lang.String of(java.lang.String);
}

So it looks like that for some reason this isn’t added automatically by Dagger, which is strange as I verified that a generated APK used R8 version 1.4.29. This should have support for generated proguard rules.

Android Studio version: 3.4 beta 3 (same issue in 3.3 stable) Dagger version: 2.21

EDIT: Fixed Android Studio version

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
ronshapirocommented, Feb 11, 2019

I opened a bug on R8 here. Let’s converge on that, and we can reopen if that ends up not being the case.

0reactions
JakeWhartoncommented, Feb 7, 2019

Maybe a bug in the toolchain only assuming it needs to carry class files as outputs?

On Thu, Feb 7, 2019 at 4:55 PM Ron Shapiro notifications@github.com wrote:

I’m seeing these files generated:

./app/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/META-INF/proguard/dagger.android.AndroidInjectionKeys ./app/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/META-INF/proguard/dagger.android.AndroidInjectionKeys

I’m not sure why R8 is not picking them up.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/dagger/issues/1415#issuecomment-461606589, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEESCuCq5g8TKGuPJp3nE1dgJ0DAvSks5vLKDugaJpZM4ahwxz .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dagger 2 does not generate component - Stack Overflow
In build 171.4073.35 Delegate IDE build/run actions to gradle option is set by ... in their gradle file to let intellij recognize dagger...
Read more >
Using Dagger in Android apps
The Dagger basics page explained how Dagger can help you automate dependency injection in your app. With Dagger, you don't have to write ......
Read more >
Deep dive into Dagger generated code (part 1) - ProAndroidDev
In this blog post, we will convert the Dagger generated code from Java to Kotlin to understand how @Inject constructors and @Provides works....
Read more >
Dagger - Square Open Source
Use @Inject to annotate the constructor that Dagger should use to create ... Classes that lack @Inject annotations cannot be constructed by Dagger....
Read more >
Using Dagger 2 for dependency injection in Android - Tutorial
@Component : enable selected modules and used for performing dependency injection. Dagger 2 uses generated code to access the fields and not reflection....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found