Open GoogleCodeExporter opened 9 years ago
The MultiDexTestRunner thing is not really a problem. It only has a single line
to call `MultiDex.install(getTargetContext())` - so I can just extend
GoogleInstrumentationTestRunner and add that line to onCreate.
However, the NoClassDefException still exists. Logcat provides more info:
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.apps.common.testing.testrunner.UsageTracker$NoOpUsageTracker
at com.google.android.apps.common.testing.testrunner.UsageTrackerRegistry.<clinit>(UsageTrackerRegistry.java:13)
at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onCreate(GoogleInstrumentationTestRunner.java:106)
Original comment by jem.maw...@gmail.com
on 5 Dec 2014 at 6:14
I'm also running into this error. And i'm using espresso-2.0 on osx
Original comment by namk...@gmail.com
on 7 Jan 2015 at 8:26
I'm using Espresso 2 as well. I implemented a custom runner that extends the
new AndroidJUnitRunner and calls MultiDex.install(getTargetContext()) in
onCreate(Bundle args). Further; I'm using a custom Application class that
extends MultiDexApplication in my app.
Logcat output:
dalvikvm﹕ Class resolved by unexpected DEX:
[Landroid/support/multidex/MultiDexApplication;]
/dalvikvm﹕ (Lde/epost/abcapp/ABCApplication; had used a different
Landroid/support/multidex/MultiDexApplication; during pre-verification)
dalvikvm﹕ Unable to resolve superclass of Labcapp/ABCApplication; (225)
/dalvikvm﹕ Link of class 'Labcapp/ABCApplication;' failed
AndroidRuntime﹕ FATAL EXCEPTION: main
Process: abcapp, PID: 2676
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to
unexpected implementation
Original comment by MufuSc...@gmail.com
on 9 Jan 2015 at 2:06
solution? could fix this issue, but finally got stuck on:
junit.framework.AssertionFailedError: Exception in constructor:
…NoClassDefFoundError
…
Original comment by to.mikek...@gmail.com
on 12 Feb 2015 at 12:54
[deleted comment]
Hi, the problem with "java.lang.IllegalAccessError: Class ref in pre-verified
class resolved to unexpected implementation" is usually due to duplicate
dependencies.
I have the current configuration that is "running" at least:
...
androidTestCompile('com.android.support.test.espresso:espresso-core:2.0') {
exclude group: 'com.google.guava'
}
androidTestCompile('com.android.support.test:testing-support-lib:0.1') {
exclude group: 'com.google.guava'
}
testingCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {
exclude group: 'com.google.guava'
exclude group: 'javax.inject'
}
Original comment by marba...@gmail.com
on 26 Feb 2015 at 4:26
The following question in SO (
http://stackoverflow.com/questions/25434099/running-tests-using-gradle-or-inside
-android-studio-result-in-noclassdeffounderr) addresses this issue. The
accepted answer helped a lot having a working version with espresso 2 using
multidex for api14+.
Original comment by marba...@gmail.com
on 26 Feb 2015 at 8:25
Original issue reported on code.google.com by
jem.maw...@gmail.com
on 5 Dec 2014 at 4:57