f2prateek/dart

[DH3] java.lang.RuntimeException: java.lang.ClassNotFoundException

StephenVinouze opened this issue · 2 comments

Hi @f2prateek @stephanenicolas ,

It's been some time I haven't used this library and I see there has been breaking changes with the 3rd version. Glad to see it!

Especially because on one of my project we're facing issues while building a consistent navigation architecture that requires to be shared across different modules. So I wanted to test this new version and see if it could be a good fit for us ;)

Problem is: I can't make my prototype project work. I'm using Kotlin but don't believe it changes anything (and was perfectly working with DH2). I built a sample app which has:

  • an app module
  • an app-navigation library module
  • a casino library module
  • a casino-navigation library module

I wanted to attach a couple of activities to each modules and add navigation models to each navigation modules and see with dependencies if I could simply route from one activity to another. I believe I'm missing something with the navigatorPackageName configuration in the build.gradle file. I tried different combination but can't managed to make this work. I went through the sample app attached to the lib but can't find what I'm doing wrong. Also found it hard to see given that module and navigation module have the same package name... Sorry for the big thread but I think it will be plainer with pictures :D

Here is the project's architecture:

architecture

The build.gradle files:

app_gradle

app_navigation_gradle

casino_gradle

casino_navigation_gradle

The code with the generated activity intent builder that causes the issue:

main_activity

myaccount_activity

main_activity_navigation_model

myaccount_activity_intent_builde

In the intent builder we can see that it tries to instanciate MyAccountActivity from package com.github.stephenvinouze.samplenavigation which is the package name of my app-navigation
module where the navigation model for this activity resides.

It would be awesome if you could point me out in the right direction! It could help me and especially my teammates to strongly consider using DH3 in our project in a very near future.

If you need more info don't hesitate and sorry again for the super long thread. I guess it will be worth it to everyone to manage to find out the issue as it is not obvious to me how to setup DH3 from the README as of now.

As before I would be happy to update again the Kotlin part in the README and also add a sample app as it is planned in open issues ;)

All the best,
Stephen

The activity and navigation model should have the same package name.
So for your case, the package name for the navigation model should be "com.github.stephenvinouze.sample", not the "com.github.stephenvinouze.samplenavigation".

Thx @jackytvlk , yes I think this is the issue you're facing @StephenVinouze . Same for GameSearchActivity, MainActivity, etc. The navigation model should be exactly : fqn of you activity + NavigationModel suffix.

We're sorry about this constraint, but that was the solution that made most sense for us.
Thx @jackytvlk for the support.