bugsnag/bugsnag-android

Error with tests in Android Studio when using ReLinker to load Bugsnag libraries

Closed this issue · 1 comments

Describe the bug

When I try to run my unit tests, ReLinker is complaining. I've added Bugsnag, and it works as it should. Later I add ReLinker like here: https://docs.bugsnag.com/platforms/android/faq/ After adding those two lines I am no longer able to run my tests.

I get the following error when trying to run tests:
``
[Robolectric] WARN: Android SDK 29 requires Java 9 (have Java 8). Tests won't be run on SDK 29 unless explicitly requested.
[Robolectric] WARN: Android SDK 30 requires Java 9 (have Java 8). Tests won't be run on SDK 30 unless explicitly requested.

Could not find 'bugsnag-ndk.dll'. Looked for: [armeabi-v7a], but only found: [java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 10
lib([^\\])\bugsnag-ndk.dll
^].
com.getkeepsafe.relinker.MissingLibraryException: Could not find 'bugsnag-ndk.dll'. Looked for: [armeabi-v7a], but only found: [java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 10
lib([^\\]
)\bugsnag-ndk.dll
^].
at com.getkeepsafe.relinker.ApkLibraryInstaller.installLibrary(ApkLibraryInstaller.java:173)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(ReLinkerInstance.java:180)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:136)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:70)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:51)
at com.roardam.vvitas.Vvitas.onCreate(Vvitas.kt:19)
at org.robolectric.android.internal.AndroidTestEnvironment.lambda$installAndCreateApplication$0(AndroidTestEnvironment.java:288)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:86)
at org.robolectric.android.internal.AndroidTestEnvironment.installAndCreateApplication(AndroidTestEnvironment.java:288)
at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:171)
at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:319)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:269)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``

I have added Bugsnag and ReLinker with this:
implementation 'com.github.KeepSafe:ReLinker:1.4.3' implementation 'com.bugsnag:bugsnag-android:5.+'

I am not entirely sure the problem is ReLinker or Bugsnag, but I am able to run the tests when I remove the two lines loading libraries.

Please let me know if I haven't shown enough code, and I'll update with whatever code needed. Thank you.

Steps to reproduce

  1. Create tests
  2. Run tests
  3. See error

Hi @CasperJorgensen,

Closing this as it has been discussed via the support email channel.

For future travellers, it was determined that this was an issue with Relinker rather than Bugsnag as this behaviour also occurs when loading libraries other than Bugsnag.