NoSuchMethodError 异常,当使用 com.google.common.base.Splitter
我正在尝试使用com.google.common.base.Splitter,如下所示
Iterable<String> segs = Splitter.on("/").split("one/two/three/four/five");
for (String seg : segs) {
System.out.println(seg);
}
但是,我看到以下异常:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Platform.precomputeCharMatcher(Lcom/google/common/base/CharMatcher;)Lcom/google/common/base/CharMatcher;
at com.google.common.base.CharMatcher.precomputed(CharMatcher.java:664)
at com.google.common.base.CharMatcher.<clinit>(CharMatcher.java:71)
at com.google.common.base.Splitter.<init>(Splitter.java:107)
at com.google.common.base.Splitter.on(Splitter.java:171)
at Test.main(Test.java:30)
有没有人知道我在这里做错了什么?