Skip to content

Test runner uses APIs only available in newer Android versions #16

Closed
orrc opened this Issue Sep 20, 2012 · 2 comments

2 participants

@orrc
orrc commented Sep 20, 2012

I just downloaded the 1.4.7 JAR and ran a test on an Android 1.6 emulator, with all the default settings.

The test runner could not start as it now uses Context.getExternalFilesDir(), which is only available from SDK level 8 (Android 2.2).

Logcat showed the following:

I/JUnitReportTestRunner(  252): Created with arguments: [coverage]
I/JUnitReportTestRunner(  252): Defaulted report file to 'junit-report.xml'
E/dalvikvm(  252): Could not find method android.content.Context.getExternalFilesDir, referenced from method com.zutubi.android.junitreport.JUnitReportListener.openOutputStream
W/dalvikvm(  252): VFY: unable to resolve virtual method 4: Landroid/content/Context;.getExternalFilesDir (Ljava/lang/String;)Ljava/io/File;
W/dalvikvm(  252): VFY:  rejecting opcode 0x6e at 0x0037
W/dalvikvm(  252): VFY:  rejected Lcom/zutubi/android/junitreport/JUnitReportListener;.openOutputStream (Ljava/lang/String;)Ljava/io/FileOutputStream;
W/dalvikvm(  252): Verifier rejected class Lcom/zutubi/android/junitreport/JUnitReportListener;
D/AndroidRuntime(  252): Shutting down VM
@jsankey
Owner
jsankey commented Oct 5, 2012

Thanks for the report. When I get a chance I'll add a reflection wrapper for this with fallback behaviour.

@jsankey jsankey added a commit that referenced this issue Oct 10, 2012
@jsankey Fix for issue #16: Test runner uses APIs only available in newer Andr…
…oid versions. Added reflection/fallback around getExternalFilesDir. Also tweaked the example to work on the emulator (the hardcoded path assumes the mount point of external storage).
75646b4
@jsankey
Owner
jsankey commented Oct 10, 2012

Fixed in commit 75646b4.

@jsankey jsankey closed this Oct 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.