Am getting this exception whilst running my app on an emulator from jenkins. It has just started occuring recently and can't really work out what I changed to cause it. When I run from IntelliJ (Android Studio) in an emulator, it seems to work fine.
My AndroidManifest.xml contains:
<uses-sdk android:minSdkVersion="15"/>
My gradle script is:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 17
testPackageName "com.sevenlights.reminder.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
}
dependencies {
compile("org.mockito:mockito-all:1.9.5")
compile("com.google.dexmaker:dexmaker:1.0")
compile("com.google.dexmaker:dexmaker-mockito:1.0"){
exclude group: 'org.hamcrest', module: 'hamcrest-core'
exclude group: 'org.mockito', module: 'mockito-core'
exclude group: 'org.objenesis', module: 'objenesis'
}
compile("joda-time:joda-time:1.5.2")
compile("nl.qbusict:cupboard:1.0.3")
compile('com.android.support:appcompat-v7:19.0.0')
compile('com.jayway.android.robotium:robotium-solo:5.0.1')
}
Full stack trace is:
05-29 20:26:53.581 I/dalvikvm( 722): Failed resolving Landroid/support/v4/media/TransportMediatorJellybeanMR2; interface 127 'Landroid/media/RemoteControlClient$OnGetPlaybackPositionListener;'
05-29 20:26:53.581 W/dalvikvm( 722): Link of class 'Landroid/support/v4/media/TransportMediatorJellybeanMR2;' failed
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): Cannot load class. Make sure it is in your apk. Class name: 'android.support.v4.media.TransportMediatorJellybeanMR2'. Message: android.support.v4.media.TransportMediatorJellybeanMR2
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): java.lang.ClassNotFoundException: android.support.v4.media.TransportMediatorJellybeanMR2
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at java.lang.Class.classForName(Native Method)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at java.lang.Class.forName(Class.java:217)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfoSource.createPackageInfo(ClassPathPackageInfoSource.java:88)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfoSource.access$000(ClassPathPackageInfoSource.java:39)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:50)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfoSource$1.load(ClassPathPackageInfoSource.java:47)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.SimpleCache.get(SimpleCache.java:31)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfoSource.getPackageInfo(ClassPathPackageInfoSource.java:72)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfo.getSubpackages(ClassPathPackageInfo.java:48)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfo.addTopLevelClassesTo(ClassPathPackageInfo.java:61)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.ClassPathPackageInfo.getTopLevelClassesRecursive(ClassPathPackageInfo.java:55)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.suitebuilder.TestGrouping.testCaseClassesInPackage(TestGrouping.java:156)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.suitebuilder.TestGrouping.addPackagesRecursive(TestGrouping.java:117)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.suitebuilder.TestSuiteBuilder.includePackages(TestSuiteBuilder.java:102)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:366)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3920)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.app.ActivityThread.access$1300(ActivityThread.java:123)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.os.Looper.loop(Looper.java:137)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at java.lang.reflect.Method.invoke(Method.java:511)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at dalvik.system.NativeStart.main(Native Method)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): Caused by: java.lang.NoClassDefFoundError: android/support/v4/media/TransportMediatorJellybeanMR2
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): ... 26 more
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): Caused by: java.lang.ClassNotFoundException: android.support.v4.media.TransportMediatorJellybeanMR2
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-29 20:26:53.601 W/ClassPathPackageInfoSource( 722): ... 26 more
As Thomas Knych says in this Google Groups discussion :
This is android.test.instrumentationtestrunner scanning every class in the apk. Some of the classes cannot be loaded. This is expected and not an issue
So you don't need to worry about. It will not prevent your application/tests to work.