android - dagger simple example gives IllegalStateException -


I'm experimenting with the dagger. Now I do not fully understand how everything works. So I wrote a test project.

This is my main activity:

  extension of the main activity of the public square (Personal Object Graph mActivityGraph; @ injection vehicle; @ Override protected void create (Bundle saved Instansstet) {Suprknkret (saved Instensstet); setContentView (R.layout.activity_main); mActivityGraph = Objektgrafksent (new Gtividhimodul ()); mActivityGraph.validate (); mActivityGraph.inject (this);}}   

This is my activity module:

  @module (injects = {vehicle class, main activity class, wheels} class}} increases the public class activity module application {@Provides WheelsWheels (new wheels (4, "X12");}}  < / pre> 

In my manifest I added activity module as a module on activism.

This is my vehicle class:

  @ module (Wheels category Included) public-class vehicle {@ injection wheels; personal string type; public vehicle (stri Type type} {this.type = type;}}   

And this is my wheel:

  public square wheels {private inch in; Private string brand; @ Inject public wheels (int inch, string brand) {this.inch = inch; This.brand = brand; }}   

What I want to do now is that I have a car in main activity that injects its wheels. Now I do not know how to make my car in main activity, because I want to create a car with a parameter in the form of a string, how the user fills.

I get this:

  Error: (8, 8) Error: Graph Verification Failed: Not Module @ edu.ida.daggertest.app. Whails error: (20 8) Error: Unknown error was thrown by JavaklangkIllegalStateException Javac Graph Verification: edu.ida.daggertest.app.Vehicle    

I found the problem. It's my edited code to close the problem graph.

  public class extends the main activity (final static String TAG = Main Gtividhikclaskgetnam (); private Objektgraf Metrvich graph; @ injection vehicle; @ Override protected create zero (bundle saved Instansstet) {Suprknkret (saved Instensstet); setContentView (R.layout.activity_main); mActivityGraph = Objektgrafksent (new Gtividhimodul ()); mActivityGraph.inject (this); Log.d (TAG, String.valueOf (car.getWheels (g) etInch ());) Log.d (TAG, car.getWheels () getBrand ().);}} @ module (injects = {vehicle class, main activity square, wheels}, complete = false) public class action module {@Provides WheelsWheels () {new wheels (4, "X12");}} public class vehicle {@ injection wheel wheels; private string type; public string getType () {return type;} public wheels Get to Wales () {Return wheels;}} Wheels of public squares {Private Inches; Private String Brand; @ injected Public Wheels (Int inch, string brand) {this.inch = inch; This.brand = brand; } Public int getInch () {return inch; } Public string matching () {return brand; }}   

To be completed requires false, otherwise the Dagger Injetable Constructor is complaining about the integer and string.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -