当我尝试运行单元测试时,ReLinker一直在抱怨。我添加了Bugsnag,它正常工作。后来我添加了如下的ReLinker:https://docs.bugsnag.com/platforms/android/faq/添加这两行代码后,我无法再运行测试。
我的应用程序onCreate包含:
ReLinker.loadLibrary(this, "bugsnag-ndk")
ReLinker.loadLibrary(this, "bugsnag-plugin-android-anr")
Bugsnag.start(this, config)
每当我尝试使用RobolectricTestRunner运行测试时,我都会收到以下错误:
[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)
我添加了ReLinker和Bugsnag:
implementation 'com.github.KeepSafe:ReLinker:1.4.3'
implementation 'com.bugsnag:bugsnag-android:5.+'
我不完全确定问题出在ReLinker上,但是当我删除加载库的两行代码时,我能够运行测试。
请让我知道,如果我没有显示足够的代码,我会更新我的职位与任何代码需要。谢谢。
1条答案
按热度按时间njthzxwz1#
这看起来是一个重新链接器问题,因为它发生在加载各种其他本机库时,而不仅仅是Bugsnag。