Closed GoogleCodeExporter closed 9 years ago
Exclude group: 'com.squareup.dagger'" should not be there (the dagger
dependency is shaded, so it should not conflict with your app).
NoClassDefFoundError is also common with proguard. If you're proguarding,
please make sure that the required classes are not being stripped out.
If you could repro this with a simple project (e.g. add dagger to
https://github.com/googlesamples/android-testing/blob/master/espresso/BasicSampl
e/app/build.gradle), that would help us with the investigation.
Original comment by vale...@google.com
on 22 Dec 2014 at 9:18
I'm also running into this error and trying to minimally reproduce it. In my
bare-bones project, I discovered that updating the support dependency from
compile 'com.android.support:support-v4:20.0.0'
to
compile 'com.android.support:support-v4:21.0.3'
seems to fix it. However, that solution is inadequate for my real project. I'm
going to see if I figure anything else out.
Original comment by bria...@gmail.com
on 23 Dec 2014 at 1:32
This project is currently producing this error for me.
Original comment by bria...@gmail.com
on 23 Dec 2014 at 1:51
Attachments:
Can you verify the basic setup works with building one of the samples on
https://github.com/googlesamples/android-testing/ and then try to reproduce the
it with one of those? Would make it easier for us.
Thanks.
Original comment by slinz...@google.com
on 23 Dec 2014 at 10:06
I just had a quick look at your build.gradle file and is there any particular
reason you are using different versions of v4 and v7? v7 depends on v4 and that
could be an issue in itself if you use 20.0.0 and 21.0.3 You should really
avoid using two different versions if possible and update them accordingly. Can
you try if that fixes the problem?
Original comment by slinz...@google.com
on 23 Dec 2014 at 10:13
There's no particular reason for the different versions aside from admitted
cargo-cult gradle programming on my part. I'll try to fix that in my project.
Here's a patch against BasicSample that reproduces the issue for me.
https://github.com/brianhv/android-testing/commit/84afc8f490869f6dabc59f8aaa223f
b71b2efb44
Original comment by bria...@gmail.com
on 23 Dec 2014 at 5:46
Having exactly same issues: tests dont run on pre-L devices, but compile and
run fine on 5.0.
Original comment by magedark...@gmail.com
on 25 Dec 2014 at 12:38
Also able to reproduce this. Emulator and physical devices work on 5.0+. Fails
for the stated reason on my 4.0 tests.
Original comment by w...@therusty.org
on 27 Dec 2014 at 11:05
Probably I've found bug reason. In my project I had the same problem when I
reached 64k methods limit. After I add `multiDexEnabled = true` property, but
forgot to extend `MultiDexApplication` I had the same issue.
In Android 5.0 it works without any problems because Lollipop natively supports
loading multiple dex files. Probably it's something similar in project tests.
Also I'm not sure about testInstrumentationRunner. Should we use
MultiDexTestRunner or AndroidJUnitRunner? I'll try the first one as soon as I
have some free time.
Original comment by froger.mcs
on 29 Dec 2014 at 6:56
My issue was the javax.inject dependency being included by espresso and dagger.
exclude group: 'javax.inject'
Original comment by w...@therusty.org
on 31 Dec 2014 at 6:41
w...@therusty.org
thank you, now it is working!
Original comment by ultrao...@gmail.com
on 31 Dec 2014 at 2:02
Excluding javax.inject fixes it for me as well.
Original comment by bria...@gmail.com
on 1 Jan 2015 at 5:32
Confirmed, excluding javax.inject fixes the problem. Thanks "#10
w...@therusty.org"
Original comment by magedark...@gmail.com
on 3 Jan 2015 at 12:23
For people who encounter similar issues in the future, if you are running via
emulator you get some helpful messages in the logs for diagnosing. E.g.:
(Ldagger/internal/Binding; had used a different Ljavax/inject/Provider; during
pre-verification)
or
DexOpt: not resolving ambiguous class 'Ljunit/framework/TestSuite;'
Then it is just a matter of finding out what dependencies are including these
classes.
Original comment by w...@therusty.org
on 3 Jan 2015 at 5:59
Original comment by vale...@google.com
on 18 Mar 2015 at 5:30
Fixed in 2.2 where we updated to Dagger2
Original comment by slinz...@google.com
on 9 Jun 2015 at 2:52
Original issue reported on code.google.com by
froger.mcs
on 22 Dec 2014 at 9:33