New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run tests with sdk < 21 anymore #2562
Comments
Hmmm, doesn't this fail for Robolectric's own unit tests that use MultiApiTestRobolectricRunner? Is there any more stack trace? |
@jongerrish here is a project which reproduces the issue. I guess the problem is that we are compiling against API 16 which does not have the referenced |
Are there any workarounds for this? |
Interesting, you're compiling against API 16? Is this common to build
against such an old version of Android? Any reasons for this?
…On Nov 24, 2016 5:10 AM, "Marty Glaubitz" ***@***.***> wrote:
Are there any workarounds for this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2562 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGBaePcCf2WpZ1H2Q92xc0xPP9TGHhJJks5rBYyugaJpZM4JOMsD>
.
|
@jongerrish of course API Level 16 - 18 (Jelly Bean) coveres still 12% of all devices |
Right, that's true, but you can still compile against a later SDK which
allows you to selectively use new API levels. Not saying that's wrong just
interesting that projects take that approach.
PackageManager is kind of a special case in Robolectric, we use a custom
implementation rather than a shadow which causes this issue. There is no
reason why it couldn't be converted to a shadow however. We'd welcome a
pull request if you're interested in contributing 😃
…On Nov 24, 2016 10:17 AM, "Marty Glaubitz" ***@***.***> wrote:
@jongerrish <https://github.com/jongerrish> of course API Level 16 - 18
(Jelly Bean) coveres still 12% of all devices
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2562 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGBaeAv24wfRw8g28PJt08HY2xuru2Ylks5rBdSygaJpZM4JOMsD>
.
|
#2729 is a start at addressing this. As a temporary workaround, could you try adding a test dependency on 'org.robolectric:android-all:6.0.0_r1-robolectric-0'? |
Add a workaround until Robolectlectric is not fixed. robolectric/robolectric#2562 (comment)
Add a workaround until Robolectlectric is not fixed. robolectric/robolectric#2562 (comment)
Add a workaround until Robolectlectric is not fixed. robolectric/robolectric#2562 (comment)
Add a workaround until Robolectlectric is not fixed. robolectric/robolectric#2562 (comment)
Add a workaround until Robolectlectric is not fixed. robolectric/robolectric#2562 (comment)
I'm using 3.3.2 and still the same problem: java.lang.NoClassDefFoundError: android/content/pm/PackageInstaller
.... Has it been pushed? |
Robolectric 4.0 is out now, please give that a try and feel free to reopen if its still an issue and we can take a look. |
If you have tests with
@Config(sdk = 16)
for example, you will get failures like this:This is because the new
DefaultPackageManager
class directly referencesandroid.content.pm.PackageInstaller
, but that is only available from API 21.Workaround for this is using SDK >= 21. But i guess Robolectric clearly supports lower SDKs.
The text was updated successfully, but these errors were encountered: