ART Unit Tests fail, Dalvik works fine

193 Views Asked by At

I've been developing an app for a while now (over here) and I'm trying to do both tests on my Android device, and the emulator.

Currently I've got a build set up on Travis and all the tests are running fine. Additionally, I have a local emulator set up that runs everything just fine. My physical device (Moto X) runs everything well too, but only when it's on Dalvik. As soon as I switch to ART, I get the following error:

11-11 15:28:54.013    6259-6259/org.bspeice.minimalbible E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: org.bspeice.minimalbible, PID: 6259
    java.lang.NoClassDefFoundError: org.jdom2.xpath.jaxen.JDOMCoreNavigator
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:305)
            at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
            at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
            at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
            at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
            at android.test.SimpleCache.get(SimpleCache.java:31)
            at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
            at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
            at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
            at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
            at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
            at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
            at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
            at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4400)
            at android.app.ActivityThread.access$1500(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5086)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)

There's a full session trace over here if that's helpful.

So my question is: Is there any reason this would be an issue with ART and not Dalvik? I haven't changed the app build process at all, the only variable that seems to make a difference is Dalvik/ART. The app itself runs fine, it's only the tests that have errors.

1

There are 1 best solutions below

1
On

It looks like ART is not finding your classes, the ClassNotFoundException being thrown. I am not skilled in java or cpp, but in my reading on ART, it is much more strict on syntax. Dalvik would accept dots or slashes as separators, ART only slashes, and such. I have a bunch of stuff that works fine on Dalvik, but falls down and dies on ART/Android-5.0.x. Have you resolved this issue yet yourself? In the next few weeks, I will be trying to determine what is wrong with my apps, but I suspect it is the more aggressive memory mangement garbage collection that ART is doing, versus Dalvik. If you resolved your issue, please post a note indicating what you did.