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

Application is crashing when using koin outside SDK #2103

Open
MANISH9912 opened this issue Jan 2, 2025 · 0 comments
Open

Application is crashing when using koin outside SDK #2103

MANISH9912 opened this issue Jan 2, 2025 · 0 comments

Comments

@MANISH9912
Copy link

Application is crashing when trying to access koin from SDK

  • I have been developing SDK where I'm using Koin as DI in that SDK.
  • I'm able to run the app successfully from other module in the same app.
  • However, if I try to use it from other Android project, application is crashing.
  • I'm using SDK in the form of aar format.

Error logs:

2025-01-02 14:34:24.522 6703-6703 AndroidRuntime com.example.feedbacksdkcheckchange E FATAL EXCEPTION: main
Process: com.example.feedbacksdkcheckchange, PID: 6703
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/koin/core/context/DefaultContextExtKt;
at com.aligntech.feedbacksdk.FeedbackSDK.init(FeedbackSDK.kt:9)
at com.example.feedbacksdkcheckchange.FeedbackSDKApplication.onCreate(FeedbackSDKApplication.kt:10)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7588)
at android.app.ActivityThread.access$1700(ActivityThread.java:315)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2286)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.koin.core.context.DefaultContextExtKt" on path: DexPathList[[dex file "/data/data/com.example.feedbacksdkcheckchange/code_cache/.overlay/base.apk/classes5.dex", zip file "/data/app/~~25IjY2UFjXW9UV7WmYzzfQ==/com.example.feedbacksdkcheckchange-eFSYpTZftzLqjBnKVvt8cA==/base.apk"],nativeLibraryDirectories=[/data/app/~~25IjY2UFjXW9UV7WmYzzfQ==/com.example.feedbacksdkcheckchange-eFSYpTZftzLqjBnKVvt8cA==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.aligntech.feedbacksdk.FeedbackSDK.init(FeedbackSDK.kt:9) 
at com.example.feedbacksdkcheckchange.FeedbackSDKApplication.onCreate(FeedbackSDKApplication.kt:10) 
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7588) 
at android.app.ActivityThread.access$1700(ActivityThread.java:315) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2286) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loopOnce(Looper.java:226) 
at android.os.Looper.loop(Looper.java:313) 
at android.app.ActivityThread.main(ActivityThread.java:8751) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

**Here are my code snippets

SDK Koin initiation code:

object FeedbackSDK {

fun init() {
    startKoin {
        modules(feedbackModule)
    }
}

}

Dependenies

implementation(project.dependencies.platform(libs.koin.bom))
implementation (libs.koin.android)
implementation (libs.koin.androidx.compose)
implementation (libs.koin.navigation.compose)
implementation(libs.koin.core)

libs.toml

koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }
koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koin" }
koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin" }
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-navigation-compose = { module = "io.insert-koin:koin-compose-viewmodel-navigation", version.ref = "koin"}

Accessing Koin outside of SDK:

FeedbackSDK.init() // Inside application onCreate

Please help here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant