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.

Wrong error in @Binds attempt

See original GitHub issue

Hello,

I have had a problem that took a while to solve and didn’t know what was the cause of it,

I have a modular Android project and i keep my repository interfaces in a module called database, for example:

interface RecipientRepository

The implementation of this interface is found in two modules called dev and mock.

The mock class looks like this:

@Singleton
class RecipientRepositoryMock @Inject constructor() : RecipientRepository

My android application is using flavors so i have flavors for mock and dev, so i use this in gradle:

    mockImplementation project(":mock")
    devImplementation project(":dev")

    //hardcoded data
    testImplementation project(":mock")

Our server had some problems so i had to switch to mock data on dev flavor, wrote this in my dagger module:

    @Binds
    abstract fun bindRecipientRepository(repository: RecipientRepositoryMock): RecipientRepository

Looks like Android Studio lets me autocomplete RecipientRepositoryMock and brings no error.

All seems fine but when i try to run i get this error:

FlavorDataModule.java:76: error: @Binds methods' parameter type must be assignable to the return type
    public abstract repository.RecipientRepository bindRecipientRepository(@org.jetbrains.annotations.NotNull()

I think binds should first check if the class specified as paramter exists before checking if it extends the return type, I got no clue that the class could not be found because i forgot to add my mock dependency to the application.

This is an error with Android Studio, but it may improve debugging for others.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

2reactions
bcorsocommented, Sep 8, 2020

I’m going to close this since its been a while without a response. Feel free to still add a repro and I’ll open it back up.

1reaction
bcorsocommented, Aug 13, 2020

Hi Rachieru,

Thanks for reporting!

I’ll take a look and see if there’s anything we can do about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve a Bind Error in Active Directory Authentication
If the values are incomplete or incorrect, the Bind request fails and you see the LDAP binding not successful message in your log...
Read more >
3 Methods for Solving Android Data Binding Errors - Atomic Spin
Here are some methods to help you figure out what's wrong. ... Trying to figure out what is causing data binding errors when...
Read more >
Unable to bind or log into LDAP using specific credentials
When i try to RDP into the DC using the built-in domain Administrator account, i'm getting this error: The system administrator has restricted...
Read more >
Infamous assembly binding error - visual studio 2010
WRN: This might result in the binder loading an incorrect assembly. WRN: It is recommended to provide a fully specified textual identity for...
Read more >
EMM AD Integration Fails With Error: 'Invalid bind credentials ...
1. Please make sure you are using the correct format of domain part. You can do a simple test in ldp.exe where you...
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