I am new to robojuice, but i need to work on a piece of code which was already built by someone else. I am facing issue if I add an extra parameter to the constructor of a class which already has @Inject. My android application crashes giving the below error with no detail description about the issue:
"java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app.envTest/com.my.app.navigation.NavigActivity}: com.google.inject.ConfigurationException: Guice configuration errors:"
I am sure this error is not with the activity, but with the new parameter i added to the constructor. If i remove that param it works fine.
Previously:
@Inject
public PlotRepo(RuntimeExceptionDao<Plot, String> plotDao, RuntimeExceptionDao<LocalPlotData, Long> localPlotDataDao) {
this.plotDao = plotDao;
this.localPlotDataDao = localPlotDataDao;
}
Facing issue for:
@Inject
public PlotRepo(RuntimeExceptionDao<Plot, String> plotDao, RuntimeExceptionDao<LocalPlotData, Long> localPlotDataDao, RuntimeExceptionDao<LocalSelPlotData, Long> localSelPlotDataDao) {
this.plotDao = plotDao;
this.localPlotDataDao = localPlotDataDao;
this.localSelPlotDataDao = localSelPlotDataDao;
}
After Debugging i got this error:
1) Could not find a suitable constructor in com.j256.ormlite.dao.RuntimeExceptionDao. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
at com.j256.ormlite.dao.RuntimeExceptionDao.class(Unknown Source)
while locating com.j256.ormlite.dao.RuntimeExceptionDao<com.myapp.s.b.sets.domain.LocalSelPlotData, java.lang.Long>
for parameter 2 at com.tp.my.sets.PlotRepo.<init>(Unknown Source)
while locating com.myapp.s.b.sets.PlotRepo
for parameter 1 at com.myapp.s.b.GroupingManager.<init>(Unknown Source)
while locating com.myapp.s.b.GroupingManager
for field at com.myapp.s.b.navigation.NavigActivity.groupingManager(Unknown Source)
while locating com.myapp.s.b.navigation.NavigActivity
Not sure where I am going wrong, also could not find much help on this. Can someone help me figure out the issue.
Thanks