Infeasible
Status Update
Comments
bd...@google.com <bd...@google.com>
be...@google.com <be...@google.com> #3
Can you run "adb logcat" during the test run? There should be a stack trace there for the NoClassDefFoundError - which class is not found?
be...@google.com <be...@google.com> #4
More specifically: is it a test class? production code class? Multidex? The whole stack trace of NoClassDefFoundError would be useful.
yr...@google.com <yr...@google.com> #5
I'd say you're probably missing a change in your instrumentation (i.e. myselfRunner):
Seehttp://developer.android.com/tools/building/multidex.html#testing
"... Alternatively, you can override onCreate in existing instrumentations like this:
public void onCreate(Bundle arguments) {
MultiDex.install(getTargetContext());
super.onCreate(arguments);
...
}"
See
"... Alternatively, you can override onCreate in existing instrumentations like this:
public void onCreate(Bundle arguments) {
MultiDex.install(getTargetContext());
super.onCreate(arguments);
...
}"
Description
Condition
1.Test device:
samsung-scl23(Japan au-kddi.Android 4.4.2),
samsung-n9002(China unicom.Android 4.4.2)
2.Application Kind
MyApplication extend MultiDexApplication
3.testInstrumentationRunner
myselfRunner extends AndroidJUnitRunner
4.Test Application
super.newApplication(cl, MockTestApplication.class.getName(), context);
this MockTestApplication extend MyApplication so it's also MultiDexApplication.
5.TestCase Kind
@RunWith(AndroidJUnit4.class)
@BeforeClass
public static void setUp() throws Exception{
@Test
public void testMyUnitTest(){
6.Except
Normally running, and out test result
7.In fact
Running tests
Test running startedTest running failed: Instrumentation run failed due to 'java.lang.NoClassDefFoundError'
Empty test suite.
8.Description
8.1.
this Bug only occur below Android 5.
Android 5,6 no this problem.
8.2.
finally i change build.gradle resolve this problem.but this is workaround not correct approach.
//
// %20Owner%20Summary%20Stars%20Reporter%20Opened
// Test running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError'
// Test running failed: Instrumentation run failed due to 'java.lang.NoClassDefFoundError'
project.getConfigurations().all { config ->
if (config.name.contains("AndroidTest")) {
config.resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (
details.useTarget("de.felixschulze.teamcity:teamcity-status-message-helper:1.2")
}
}
}
}
8.3. i'm sure this is not other build.gradle dependencies compile setting problem.
i've been checked.
./gradlew app:dependencies
and setting
exclude group: ..........
please fix this bug.