Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lateinit property Presenter has not been initialized

See original GitHub issue

routesPresenter.getRoutes(“18089”) thrown exception:

kotlin.UninitializedPropertyAccessException: lateinit property routesPresenter has not been initialized

class MainFragment: MvpAppCompatFragment(), RoutesView {
    lateinit var routesPresenter: RoutesPresenter

    var adapter: RoutesAdapter = RoutesAdapter()

    companion object{

        fun newInstance(): MainFragment {
            return MainFragment()


    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val v = inflater?.inflate(R.layout.fragment_main, container, false)
        return v

    override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        recyclerView.layoutManager = LinearLayoutManager(activity)
        recyclerView.adapter = adapter



    override fun onSuccess(list: List<Route>) {
         Log.d("MainFragment", "onSuccess")

    override fun onEmptyData() {
        Log.d("MainFragment", "onEmpty")

    override fun onError(e: Throwable) {
        Log.e("MainFragment", "error ${e.message}" )

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

Arash-gmcommented, Aug 1, 2017

I have same issue, when i change orientation and call a funtion from presenter , kotlin throws : lateinit property Presenter has not been initialized , as you said i remove kapt plugin but it keep throwing error :

Error:Execution failed for task ':data:compileReleaseJavaWithJavac'.
> kotlin.jvm.internal.FunctionReference.<init>(ILjava/lang/Object;)V
CherryPerrycommented, Nov 3, 2016

Do you use kapt in your gradle file for moxy compiler?

Read more comments on GitHub >

github_iconTop Results From Across the Web

lateinit property presenter has not been initialized through ...
This code should be in your fragment not in presenter because Presenter is a dependency for a Fragment. Share.
Read more >
How to Check if a "lateinit" Variable Has Been Initialized or ...
If we don't initialize a lateinit variable before using it gives an error of “lateinit property has not been initialized”. You can check...
Read more >
lateinit property androidInjector has not been initialized ...
In your application class you define an @Inject property, but you don't initialize it anywhere. What you need to do is: first declare...
Read more >
Initializing lazy and lateinit variables in Kotlin - LogRocket Blog
Firstly, memory is not allocated to a lateinit property at the time of declaration. The initialization takes place later when you see fit....
Read more >
Dagger2 + Kotlin: lateinit property has not been initialized
Android : Dagger2 + Kotlin: lateinit property has not been initialized [ Beautify Your Computer : ] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found