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.

closestKodein is not working with androidx.fragment.app.Fragment

See original GitHub issue

im using

implementation 'org.kodein.di:kodein-di-generic-jvm:6.3.0'
implementation 'org.kodein.di:kodein-di-framework-android-x:6.3.0'

and here’s the fragment class

...
import androidx.fragment.app.Fragment
import org.kodein.di.KodeinAware
import org.kodein.di.android.closestKodein

class LoginFragment : Fragment(), KodeinAware {
    override val kodein by closestKodein()
...
}

is says: Property delegate must have a 'ProvideDelegate…

what am i missing?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
romainbslcommented, Jun 25, 2019

Sorry, this is a bug. I will correct this asap

0reactions
romainbslcommented, Dec 12, 2019

What kind of import do you have for closestKodein in your class ?

Using the following should work:

import org.kodein.di.android.x.closestKodein
Read more comments on GitHub >

github_iconTop Results From Across the Web

closestKodein is not working with androidx.fragment ... - GitHub
im using implementation 'org.kodein.di:kodein-di-generic-jvm:6.3.0' implementation 'org.kodein.di:kodein-di-framework-android-x:6.3.0' and ...
Read more >
how to inject dependency outside activity or fragment in ...
closestKodein only works in Android Context aware classes (such as fragments & activities). To use it outside of these classes, you need an...
Read more >
Fragment | Android Developers
Fragment . Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation...
Read more >
Fragment Class (Android.App) - Microsoft Learn
A Fragment is a piece of an application's user interface or behavior that can be placed in an Activity.
Read more >
AndroidX FragmentFactory and Android Fragments - Medium
Fragments provide core Android app functionality. · Before AndroidX, the developer included a default, no-argument fragment constructor in their custom fragment ...
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