Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
orrc opened this Issue · 2 comments

2 participants

@orrc

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

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

@jsankey jsankey referenced this issue from a commit
@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

Fixed in commit 75646b4.

@jsankey jsankey closed this
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.