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.

Crash caused by not founded definitions after migrating to 2.2.2 from 2.0.1

See original GitHub issue

Describe the bug Crashes occurred after upgrading from 2.0.1 to 2.2.2.

In my project I have:

BaseFragment

open class BaseFragment(
    val qualifier: String
) : Fragment() {
    protected val router: AppRouter by inject(named("${qualifier}_ROUTER"))
}

const val SCREEN_A_QUALIFIER = "SCREEN_A"

class ScreenAFragment : BaseFragment(qualifier = SCREEN_A_QUALIFIER)

AppRouter for navigation open class AppRouter

ScreenARouter is a router for ScreenA class ScreenARouter : AppRouter

val screenAModule = module {
    val routerQualifier = named("${SCREEN_A_QUALIFIER}_ROUTER")
    single(routerQualifier) {
        ScreenARouter()
    }
}

screenAModule is loaded at app startup in Application class.

Expected behavior On version 2.0.1 I had no crashes and dependencies resolved correctly. But after updating on 2.2.2 I get a crash that definitions not founded:

 Caused by: org.koin.core.error.NoBeanDefFoundException: No definition found for class:'ru.my.project.base.AppRouter' & qualifier:'SCREEN_A_ROUTER'. Check your definitions!
        at org.koin.core.scope.Scope.throwDefinitionNotFound(Scope.kt:282)
        at org.koin.core.scope.Scope.resolveInstance(Scope.kt:251)
        at org.koin.core.scope.Scope.get(Scope.kt:204)
        at ru.my.project.base.BaseFragment$$special$$inlined$inject$1.invoke(ComponentCallbackExt.kt:69)

Koin project used and used version (please complete the following information):

def koin_version = "2.2.2"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-androidx-scope:$koin_version"
implementation "org.koin:koin-androidx-viewmodel:$koin_version"

It seems to me that my problem is caused by that changes - https://github.com/InsertKoinIO/koin/commit/0a71742243c1fee49a64fa2e05f3035b9ec17ab3, where KClass<*> was replaced by KClass<T>. For example:

Was:

fun <T> get(
    clazz: KClass<*>,
    qualifier: Qualifier? = null,
    parameters: ParametersDefinition? = null
): T

Now:

fun <T : Any> get(
    clazz: KClass<T>,
    qualifier: Qualifier? = null,
    parameters: ParametersDefinition? = null
): T

And now I don’t have a clue is it a bug or feature, but now it don’t let to migrate to new version safely.

Thanks in advance for the help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fobo66commented, Dec 25, 2020

Similar issue for me: Caused by: org.koin.core.error.NoBeanDefFoundException: No definition found for class:'androidx.lifecycle.SavedStateHandle'. Check your definitions!

Looks like it does not create scope properly, however code looks OK.

0reactions
nikiJavacommented, Dec 6, 2021

@arnaudgiuliani Sorry, upgrade to 3.1.3 or even to 3.1.4 is not working for me 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

config_inputEventCompatProces...
I was digging into the Android source code and I found the real reason that can throw NPE. Affected lines from ViewRootImpl.java :...
Read more >
Upgrading from 1.10 to 2 - Apache Airflow
1. Most breaking DAG and architecture changes of Airflow 2.0 have been backported to Airflow 1.10.15. This backward-compatibility does not mean that 1.10.15 ......
Read more >
Changes — Flask Documentation (2.2.x)
Overriding FlaskClient.open will not cause an error on redirect. ... The flask run command no longer fails if Python is not built with...
Read more >
Classification of Motor Vehicle Traffic Crashes in Texas
6.0 DEFINITIONS AND INTERPRETATIONS FOR LOCATION OF MOTOR VEHICLE ... in a motor vehicle traffic crash may or may not be the direct...
Read more >
Changelog: Twilio Conversations iOS SDK
Twilio supports version N-1 for 12 months after the first GA release of version N. We ... Fixed a rare crash caused by...
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