I've had a major breakthrough on this. I'm posting my progress here http://stackoverflow.com/questions/12087948/test-apk-does-not-resolve-load-classes-from-main-apk-cannot-load-class-andr
My conclusion thus far is that android instrumentation tests do not support FragmentActivity or other activity wrappers at this point in time. -Michael On Thursday, August 23, 2012 10:56:18 AM UTC+2, blizzard wrote: > > Hello everyone, > > I'm having trouble executing instrumentation tests using the android maven > plugin. I have followed the "libraryprojects" example to the last detail, > however, there is one slight difference in my setup ~ i'm adding the > android support jar as an external dependency. > > My setup looks as follows: > > APK lib project (greendroid to be specific) > > <dependency> > <groupId>com.google.android</groupId> > <artifactId>support-v4</artifactId> > <version>r6</version> > </dependency> > > <dependency> > <groupId>com.google.android</groupId> > <artifactId>android</artifactId> > <scope>provided</scope> > </dependency> > > <dependency> > <groupId>junit</groupId> > <artifactId>junit</artifactId> > <scope>test</scope> > </dependency> > APK project > > <dependency> > <groupId>com.google.android</groupId> > <artifactId>android</artifactId> > <scope>provided</scope> > </dependency> > <dependency> > <groupId>greendroid</groupId> > <artifactId>GreenDroidFragment</artifactId> > <version>1.0.0-SNAPSHOT</version> > <type>apklib</type> > </dependency> > APK test project (and here's the problem .... ) > > <dependency> > <groupId>com.google.android</groupId> > <artifactId>support-v4</artifactId> > <version>r6</version> > </dependency> > <dependency> > <groupId>com.google.android</groupId> > <artifactId>android</artifactId> > <scope>provided</scope> > </dependency> > <dependency> > <groupId>com.google.android</groupId> > <artifactId>android-test</artifactId> > <scope>provided</scope> > </dependency> > > <dependency> > <groupId>com.jayway.android.robotium</groupId> > <artifactId>robotium-solo</artifactId> > <version>3.2.1</version> > </dependency> > > <dependency> > <groupId>com.entersectmobile</groupId> > <artifactId>NMACFragment</artifactId> > <version>1.0.0-SNAPSHOT</version> > <type>apk</type> > <scope>provided</scope> > </dependency> > > <dependency> > <groupId>com.entersectmobile</groupId> > <artifactId>NMACFragment</artifactId> > <version>1.0.0-SNAPSHOT</version> > <type>jar</type> > <scope>provided</scope> > </dependency> > The problem is that delvik is unable to find or link support jar upon > running instrumentation tests. > > By packaging the android support jar as part of the APK test project, > delvik complains that it's unable to resolve the compiled code. This is > because the dex output of the main APK is different from the dex output of > the test APK. > > W/dalvikvm(328): Class resolved by unexpected DEX: > Lcom/entersectmobile/android/nedbank/GenerateOtpFragment;(0x44edffb0):0x121de0 > > ref > [Landroid/support/v4/app/Fragment;] > Landroid/support/v4/app/Fragment;(0x44edffb0) > By not packaging the android support as part of the APK test project, > delvik is unable to locate the compiled code. This happens when making the > scope provided or excluding the dependency completely. > > W/ClassPathPackageInfoSource(632): Cannot load class. Make sure it is in > your apk. > Class name: 'android.support.v4.os.ParcelableCompatCreatorHoneycombMR2'. > Message: android.support.v4.os.ParcelableCompatCreatorHoneycombMR2 > The only thing I can think of is to somehow manually tell the APK test > project to resolve the android-support dependency from the main APK project > using a delvik linking mechanism. > > Any ideas would be much appreciated, > Thanks > -Michael > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en