Dagger and libgdx

懵懂的女人 提交于 2019-12-11 08:57:30

问题


Is it possible to use dagger 2 and libgdx web? The libgdx project builds fine with android and desktop. When I add a web module and run with

./gradlew html:superDev

[ERROR] Line 1: The type javax.inject.Named cannot be resolved. It is indirectly referenced from required .class files
      [ERROR] Line 30: The import dagger.Lazy cannot be resolved
      [ERROR] Line 32: The import javax.inject.Inject cannot be resolved
      [ERROR] Line 37: Inject cannot be resolved to a type

After following this http://www.g-widgets.com/2017/06/28/dependency-injection-in-gwt-using-dagger-2 . I have in my Game.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://www.gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module>
    <inherits name="dagger.Dagger" />
    <source path="com/trashmelody" />
</module>

It will throw a different error

 [ERROR] Line 34: No source code is available for type com.trashmelody.di.ComponentProvider<T>; did you forget to inherit a required module?
      [ERROR] Line 34: No source code is available for type com.trashmelody.di.AppComponent; did you forget to inherit a required module?
      [ERROR] Line 47: No source code is available for type com.trashmelody.managers.ScreenProvider; did you forget to inherit a required module?
      [ERROR] Line 177: No source code is available for type com.trashmelody.di.DaggerAppComponent; did you forget to inherit a required module?
      [ERROR] Line 178: No source code is available for type com.trashmelody.di.AppModule; did you forget to inherit a required module?

Does it mean we have to inherit all the errors in the xml?

来源:https://stackoverflow.com/questions/54048878/dagger-and-libgdx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!