由于发生错误,无法创建Bean Bean [class = com.melayer.codekuladminpanel.login.data.LoginRepository]:

时间:2018-09-10 09:36:17

标签: android kotlin mvp koin

致命异常:主要

                                                                       java.lang.RuntimeException: Unable to resume activity {com.melayer.codekuladminpanel/com.melayer.codekuladminpanel.login.ui.LoginActivity}: org.koin.error.BeanInstanceCreationException: Can't create bean Factory[class=com.melayer.codekuladminpanel.login.mvp.LoginContract.Presenter] due to error :
                                                                        org.koin.error.BeanInstanceCreationException: Can't create bean Bean[class=com.melayer.codekuladminpanel.login.data.LoginRepository] due to error :
                                                                        org.koin.error.BeanInstanceCreationException: Can't create bean Bean[name='remoteDataSource', class=com.melayer.codekuladminpanel.login.data.source.remote.LoginRemoteDataSource] due to error :
                                                                        org.koin.error.BeanInstanceCreationException: Can't create bean Bean[class=retrofit2.Retrofit] due to error :
                                                                        java.lang.IllegalArgumentException: baseUrl must end in /: http://192.168.15.121:8282/codekul
                                                                           at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2458)
                                                                           at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2486)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2000)
                                                                           at android.app.ActivityThread.access$600(ActivityThread.java:128)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                           at android.os.Looper.loop(Looper.java:137)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:4517)
                                                                           at java.lang.reflect.Method.invokeNative(Native Method)
                                                                           at java.lang.reflect.Method.invoke(Method.java:511)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
                                                                           at dalvik.system.NativeStart.main(Native Method)
                                                                        Caused by: org.koin.error.BeanInstanceCreationException: Can't create bean Factory[class=com.melayer.codekuladminpanel.login.mvp.LoginContract.Presenter] due to error :
                                                                        org.koin.error.BeanInstanceCreationException: Can't create bean Bean[class=com.melayer.codekuladminpanel.login.data.LoginRepository] due to error :
                                                                        org.koin.error.BeanInstanceCreationException: Can't create bean Bean[name='remoteDataSource', class=com.melayer.codekuladminpanel.login.data.source.remote.LoginRemoteDataSource] due to error :
                                                                        org.koin.error.BeanInstanceCreationException: Can't create bean Bean[class=retrofit2.Retrofit] due to error :
                                                                        java.lang.IllegalArgumentException: baseUrl must end in /: http://192.168.15.121:8282/codekul
                                                                           at org.koin.core.instance.InstanceFactory.createInstance(InstanceFactory.kt:63)
                                                                           at org.koin.core.instance.InstanceFactory.retrieveInstance(InstanceFactory.kt:22)
                                                                           at org.koin.KoinContext$resolveInstance$$inlined$synchronized$lambda$1.invoke(KoinContext.kt:85)
                                                                           at org.koin.KoinContext$resolveInstance$$inlined$synchronized$lambda$1.invoke(KoinContext.kt:23)
                                                                           at org.koin.ResolutionStack.resolve(ResolutionStack.kt:23)
                                                                           at org.koin.KoinContext.resolveInstance(KoinContext.kt:80)
                                                                           at com.melayer.codekuladminpanel.login.ui.LoginFragment$$special$$inlined$inject$2.invoke(AndroidExt.kt:133)
                                                                           at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
                                                                           at com.melayer.codekuladminpanel.login.ui.LoginFragment.getPresenter(LoginFragment.kt)
                                                                           at com.melayer.codekuladminpanel.login.ui.LoginFragment.onResume(LoginFragment.kt:50)
                                                                           at android.support.v4.app.Fragment.performResume(Fragment.java:2401)
                                                                           at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1465)
                                                                           at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
                                                                           at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
                                                                           at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3217)
                                                                           at android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3181)
                                                                           at android.support.v4.app.FragmentController.dispatchResume(FragmentController.java:214)
                                                                           at android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:470)
                                                                           at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:459)
                                                                        at android.suppo

1 个答案:

答案 0 :(得分:0)

构建Retrofit实例时,必须为它提供baseUrl ,而无需其他路径

您当前正在提供

http://192.168.15.121:8282/codekul

将其更改为

http://192.168.15.121:8282/

请注意结尾的/