java.lang.IllegalArgumentException: App ID长度必须为32个字符
java.lang.IllegalArgumentException: App ID length must be 32 characters
当我尝试 运行 JUnit 测试时遇到问题 class
java.lang.RuntimeException: java.lang.IllegalArgumentException: App ID length must be 32 characters.
at org.robolectric.RobolectricTestRunner.evaluate(RobolectricTestRunner.java:244)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:188)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner.evaluate(RobolectricTestRunner.java:152)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
原因:java.lang.IllegalArgumentException:App ID 长度必须为 32 个字符。
at net.hockeyapp.android.utils.Util.sanitizeAppIdentifier(Util.java:127)
at net.hockeyapp.android.CrashManager.initialize(CrashManager.java:490)
at net.hockeyapp.android.CrashManager.register(CrashManager.java:124)
at net.hockeyapp.android.CrashManager.register(CrashManager.java:97)
at net.hockeyapp.android.CrashManager.register(CrashManager.java:85)
at app.fabhotels.FabHotelApp.checkForCrashes(FabHotelApp.java:64)
您似乎正在 Application
的 onCreate()
中安装 CrashManager
。
如果你有一个复杂的 Application
class 它可能不适合在你的 Robolectric 测试中使用它。
一个解决方案是创建一个空的 Application
class:
public void EmptyApp extends Application {
}
那么您的测试设置可能如下所示:
@RunWith(RobolectricTestRunner.class)
@Config(application = EmptyApplication.class, manifest = "src/main/AndroidManifest.xml", sdk = 23)
当我尝试 运行 JUnit 测试时遇到问题 class
java.lang.RuntimeException: java.lang.IllegalArgumentException: App ID length must be 32 characters.
at org.robolectric.RobolectricTestRunner.evaluate(RobolectricTestRunner.java:244)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:188)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner.evaluate(RobolectricTestRunner.java:152)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
原因:java.lang.IllegalArgumentException:App ID 长度必须为 32 个字符。
at net.hockeyapp.android.utils.Util.sanitizeAppIdentifier(Util.java:127)
at net.hockeyapp.android.CrashManager.initialize(CrashManager.java:490)
at net.hockeyapp.android.CrashManager.register(CrashManager.java:124)
at net.hockeyapp.android.CrashManager.register(CrashManager.java:97)
at net.hockeyapp.android.CrashManager.register(CrashManager.java:85)
at app.fabhotels.FabHotelApp.checkForCrashes(FabHotelApp.java:64)
您似乎正在 Application
的 onCreate()
中安装 CrashManager
。
如果你有一个复杂的 Application
class 它可能不适合在你的 Robolectric 测试中使用它。
一个解决方案是创建一个空的 Application
class:
public void EmptyApp extends Application {
}
那么您的测试设置可能如下所示:
@RunWith(RobolectricTestRunner.class)
@Config(application = EmptyApplication.class, manifest = "src/main/AndroidManifest.xml", sdk = 23)