• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Retrofit2 NullPointerException Error

umtblbl

Member
Hello friends, retrofit and trying to develop a simple weather app by reducing your dependencies using dagger2. I get the following error. You can view the project with github link.

I am a beginner, I have little time left for my school project and delivery, I cannot proceed in the project, please help me :(

Github Link: https://github.com/rumtblbl/LocationWeatherApp

Error;
-----------------------------------------
com.example.locationweatherapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.locationweatherapp, PID: 9627
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.locationweatherapp/com.example.locationweatherapp.Ui.MainActivity.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void com.example.locationweatherapp.Data.DataManager.weatherCityNameService(java.lang.String, com.example.locationweatherapp.Data.Network.Service.ServiceCallBack)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void com.example.locationweatherapp.Data.DataManager.weatherCityNameService(java.lang.String, com.example.locationweatherapp.Data.Network.Service.ServiceCallBack)' on a null object reference
at com.example.locationweatherapp.Ui.MainActivity.MainActivityPresenter.getCityNameWeather(MainActivityPresenter.java:32)
at com.example.locationweatherapp.Ui.MainActivity.MainActivity.onCreate(MainActivity.java:74)
--------------------------------------------------
 
Back
Top Bottom