Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError in version 4.0.0 #2009

Open
hosseinaminii opened this issue Sep 29, 2024 · 3 comments
Open

java.lang.NoSuchMethodError in version 4.0.0 #2009

hosseinaminii opened this issue Sep 29, 2024 · 3 comments
Labels
question Usage question

Comments

@hosseinaminii
Copy link

hosseinaminii commented Sep 29, 2024

Describe the bug
After updating to version 4.0.0, by using the androidContext() function in Koin config it throws java.lang.NoSuchMethodError but without using this function it seems everything works properly.

To Reproduce
Steps to reproduce the behavior:

  1. Add koin to a KMP project
  2. On Android application in Application class, inside startKoin call the androidContext() function and pass it the Application class
  3. By running the Android app it crashes with the mentioned exception.

Expected behavior
Everything works like older versions without throwing NoSuchMethodError exception

Koin module and version:
koin-core:4.0.0

Snippet or Sample project to help reproduce

   class MyApplication : Application() {
        override fun onCreate() {
            super.onCreate()
            startKoin {
                androidContext(this@MyApplication)
                androidLogger()
                modules(someModule)
            }
        }

    }
@kmbisset89
Copy link

Did you add the Koin Android dependency?

Can you show you build gradle?

@syt0r
Copy link

syt0r commented Oct 25, 2024

Should we use both koin-compose and koin-androidx-compose libraries? Because from the documentation here I assumed that androidContext would be also available in koin-compose

@kmbisset89
Copy link

@syt0r

You should include:
koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }

This will allow you to get androidContext. The koin-compose does not because that was targeted for multiplatform commonMain.

@arnaudgiuliani arnaudgiuliani added the question Usage question label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usage question
Projects
None yet
Development

No branches or pull requests

4 participants