Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError: dagger.internal.ModuleAdapter.<init> #3

Open
dpkirchner opened this issue Mar 10, 2014 · 2 comments
Open

NoSuchMethodError: dagger.internal.ModuleAdapter.<init> #3

dpkirchner opened this issue Mar 10, 2014 · 2 comments

Comments

@dpkirchner
Copy link

I'm attempting to use fb-android-dagger and am running in to some trouble. I created a barebones project in order to show the problem and have posted it here:

https://dl.dropboxusercontent.com/u/99107327/MyApplication.tar.gz

I have tried removing the entries in includes, modifying injects to inject MainActivity.class itself. I'm not sure what else to try. Ultimately I would like to get a Context from InjectingActivityModule's provideActivityContext method, but at this point I'm stuck with the NoSuchMethodError.

I am using Dagger 1.2.1 and fb-android-dagger 1.0.1 and I'm running Android 4.4.2 on a Nexus 4 (Dalvik).

The stacktrace:

03-10 11:04:00.126  11985-11985/com.example.myapplication3.app I/dalvikvm﹕ Could not find method dagger.internal.ModuleAdapter.<init>, referenced from method com.fizzbuzz.android.dagger.InjectingApplication$InjectingApplicationModule$$ModuleAdapter.<init>
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app W/dalvikvm﹕ VFY: unable to resolve direct method 16223: Ldagger/internal/ModuleAdapter;.<init> ([Ljava/lang/String;[Ljava/lang/Class;Z[Ljava/lang/Class;ZZ)V
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app D/dalvikvm﹕ VFY: replacing opcode 0x76 at 0x000a
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app D/dalvikvm﹕ DexOpt: couldn't find field Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.module
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app W/dalvikvm﹕ VFY: unable to resolve instance field 636
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app D/dalvikvm﹕ VFY: replacing opcode 0x54 at 0x0004
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app D/dalvikvm﹕ DexOpt: couldn't find field Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.module
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app I/dalvikvm﹕ DexOpt: unable to optimize instance field ref 0x027c at 0x12 in Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.getBindings
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app D/dalvikvm﹕ DexOpt: couldn't find field Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.module
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app I/dalvikvm﹕ DexOpt: unable to optimize instance field ref 0x027c at 0x20 in Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.getBindings
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app D/AndroidRuntime﹕ Shutting down VM
03-10 11:04:00.126  11985-11985/com.example.myapplication3.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x415a9ba8)
03-10 10:59:23.490  11677-11677/com.example.myapplication3.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.myapplication3.app, PID: 11677
    java.lang.NoSuchMethodError: dagger.internal.ModuleAdapter.<init>
            at com.fizzbuzz.android.dagger.InjectingApplication$InjectingApplicationModule$$ModuleAdapter.<init>(InjectingApplication$InjectingApplicationModule$$ModuleAdapter.java:20)
            at java.lang.Class.newInstanceImpl(Native Method)
            at java.lang.Class.newInstance(Class.java:1208)
            at dagger.internal.Loader.instantiate(Loader.java:84)
            at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:42)
            at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:40)
            at dagger.internal.Memoizer.get(Memoizer.java:56)
            at dagger.internal.FailoverLoader.getModuleAdapter(FailoverLoader.java:57)
            at dagger.internal.Modules.loadModules(Modules.java:43)
            at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:174)
            at dagger.ObjectGraph$DaggerObjectGraph.access$000(ObjectGraph.java:138)
            at dagger.ObjectGraph.create(ObjectGraph.java:129)
            at com.fizzbuzz.android.dagger.InjectingApplication.onCreate(InjectingApplication.java:57)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
            at android.app.ActivityThread.access$1500(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)
@adennie
Copy link
Owner

adennie commented Mar 10, 2014

Hi David,

It's on my to-do list to get back to that lib and make sure it works
with newer dagger versions. When I wrote it, dagger was very new
(version 1.0.0); maybe something subsequently changed that broke
fb-android-dagger.

Just to see if that might be the case, could you try using dagger 1.0.0
and see if the same problem happens? If yes, then I'd suggest going
back to 1.2.1 and then simplifying the "barebones" project further by
eliminating fb-android-dagger and just using dagger directly, but in a
fashion similar to what fb-android-dagger does (my lib really just pulls
together some boilerplate code so you don't have to write it yourself in
each app you develop). Assuming the problem is still present, you
should have something pretty minimal and can then seek help from the
Square guys or other folks on Stack Overflow.

-Andy

David Kirchner mailto:notifications@github.com
Monday, March 10, 2014 12:07 PM

I'm attempting to use fb-android-dagger and am running in to some
trouble. I created a barebones project in order to show the problem
and have posted it here:

https://dl.dropboxusercontent.com/u/99107327/MyApplication.tar.gz

I have tried removing the entries in includes, modifying injects to
inject MainActivity.class itself. I'm not sure what else to try.
Ultimately I would like to get a Context from
InjectingActivityModule's provideActivityContext method, but at this
point I'm stuck with the NoSuchMethodError.

I am using Dagger 1.2.1 and fb-android-dagger 1.0.1 and I'm running
Android 4.4.2 on a Nexus 4 (Dalvik).

The stacktrace:

|03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
I/dalvikvm﹕ Could not find method
dagger.internal.ModuleAdapter., referenced from method
com.fizzbuzz.android.dagger.InjectingApplication$InjectingApplicationModule$$ModuleAdapter.
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
W/dalvikvm﹕ VFY: unable to resolve direct method 16223:
Ldagger/internal/ModuleAdapter;.
([Ljava/lang/String;[Ljava/lang/Class;Z[Ljava/lang/Class;ZZ)V
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
D/dalvikvm﹕ VFY: replacing opcode 0x76 at 0x000a
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
D/dalvikvm﹕ DexOpt: couldn't find field
Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.module
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
W/dalvikvm﹕ VFY: unable to resolve instance field 636
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
D/dalvikvm﹕ VFY: replacing opcode 0x54 at 0x0004
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
D/dalvikvm﹕ DexOpt: couldn't find field
Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.module
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
I/dalvikvm﹕ DexOpt: unable to optimize instance field ref 0x027c at
0x12 in
Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.getBindings
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
D/dalvikvm﹕ DexOpt: couldn't find field
Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.module
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
I/dalvikvm﹕ DexOpt: unable to optimize instance field ref 0x027c at
0x20 in
Lcom/fizzbuzz/android/dagger/InjectingApplication$InjectingApplicationModule$$ModuleAdapter;.getBindings
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
D/AndroidRuntime﹕ Shutting down VM
03-10 11:04:00.126 11985-11985/com.example.myapplication3.app
W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception
(group=0x415a9ba8)
03-10 10:59:23.490 11677-11677/com.example.myapplication3.app
E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.myapplication3.app, PID: 11677
java.lang.NoSuchMethodError: dagger.internal.ModuleAdapter.
at
com.fizzbuzz.android.dagger.InjectingApplication$InjectingApplicationModule$$ModuleAdapter.(InjectingApplication$InjectingApplicationModule$$ModuleAdapter.java:20)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at dagger.internal.Loader.instantiate(Loader.java:84)
at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:42)
at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:40)
at dagger.internal.Memoizer.get(Memoizer.java:56)
at dagger.internal.FailoverLoader.getModuleAdapter(FailoverLoader.java:57)
at dagger.internal.Modules.loadModules(Modules.java:43)
at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:174)
at dagger.ObjectGraph$DaggerObjectGraph.access$000(ObjectGraph.java:138)
at dagger.ObjectGraph.create(ObjectGraph.java:129)
at
com.fizzbuzz.android.dagger.InjectingApplication.onCreate(InjectingApplication.java:57)
at
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
|


Reply to this email directly or view it on GitHub
https://github.com/fizz-buzz/fb-android-dagger/issues/3.

@shehabic
Copy link

The lib. is no longer usable with dagger 1.2 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants