Describe the bug
After adding the purchases-kmp library to an android kmp project the androidUnitTest using robolectric stop working. It seems to have something to with the an amazon dependency.
- Environment
- Platform: Android
- SDK version: "1.3.2+13.9.0"
- OS version:
- IDE (e.g. Android Studio, Xcode, Fleet): Android Studio
- IDE version: Android Studio Koala | 2024.1.1 Patch 2 / Build #AI-241.18034.62.2411.12169540
- Device and/or emulator/simulator:
- Environment:
- How widespread is the issue. Percentage of devices affected.
- Debug logs that reproduce the issue
- Steps to reproduce, with a description of expected vs. actual behavior
Expected bahavior would be that the tests run
Steps to reproduce:
- Write a simple robolectric test in
androidUnitTest in shared
- Add purchases-kmp depencendy
- Run test
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to
have context, eg. stackoverflow, etc.)
Expecting a stackmap frame at branch target 11
Exception Details:
Location:
com/amazon/device/iap/ResponseReceiver.onReceive(Landroid/content/Context;Landroid/content/Intent;)V @0: invokestatic
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: b800 0c2b 2cb6 000b a700 1d4e b200 09bb
0000010: 0008 59b7 000f 1201 b600 112d b600 10b6
0000020: 0012 b800 0db1
Exception Handler Table:
bci [0, 8] => handler: 11
java.lang.VerifyError: Expecting a stackmap frame at branch target 11
Exception Details:
Location:
com/amazon/device/iap/ResponseReceiver.onReceive(Landroid/content/Context;Landroid/content/Intent;)V @0: invokestatic
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: b800 0c2b 2cb6 000b a700 1d4e b200 09bb
0000010: 0008 59b7 000f 1201 b600 112d b600 10b6
0000020: 0012 b800 0db1
Exception Handler Table:
bci [0, 8] => handler: 11
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.base/java.lang.Class.getConstructor0(Unknown Source)
at java.base/java.lang.Class.getDeclaredConstructor(Unknown Source)
at org.robolectric.util.ReflectionHelpers.callConstructor(ReflectionHelpers.java:519)
at org.robolectric.internal.bytecode.ShadowImpl.newInstanceOf(ShadowImpl.java:19)
at org.robolectric.shadow.api.Shadow.newInstanceOf(Shadow.java:39)
at org.robolectric.android.internal.AndroidTestEnvironment.registerBroadcastReceivers(AndroidTestEnvironment.java:656)
at org.robolectric.android.internal.AndroidTestEnvironment.installAndCreateApplication(AndroidTestEnvironment.java:364)
at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$0(AndroidTestEnvironment.java:262)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:51)
at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$1(AndroidTestEnvironment.java:259)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:200)
at org.robolectric.RuntimeEnvironment.lambda$getApplication$0(RuntimeEnvironment.java:71)
at org.robolectric.shadows.ShadowInstrumentation.runOnMainSyncNoIdle(ShadowInstrumentation.java:1190)
at org.robolectric.RuntimeEnvironment.getApplication(RuntimeEnvironment.java:71)
at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:230)
at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:284)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:279)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:104)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Additional context
Robolectric version 4.14.1
Junit 4.13.2
the Contribution Guidelines
for existing Github issues
Describe the bug
After adding the purchases-kmp library to an android kmp project the
androidUnitTestusing robolectric stop working. It seems to have something to with the an amazon dependency.Expected bahavior would be that the tests run
Steps to reproduce:
androidUnitTestin sharedhave context, eg. stackoverflow, etc.)
Additional context
Robolectric version 4.14.1
Junit 4.13.2