Не удается создать bean-компонент [class = com.melayer.codekuladminpanel.login.data.loginrepository] из-за ошибки:

FATAL EXCEPTION: главная

                                                                       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

поделиться кодом LoginActivity.java

Radesh 10.09.2018 11:44
1
1
179
1

Ответы 1

При создании экземпляра Retrofit вы должны предоставить ему baseUrl без дополнительного пути.

В настоящее время вы предоставляете

http://192.168.15.121:8282/codekul

Измените это на

http://192.168.15.121:8282/

Обратите внимание на завершающий /, он необходим.

Другие вопросы по теме