简体   繁体   English

Java GWT编译错误NoSuchMethodError

[英]Java GWT Compile Error NoSuchMethodError

This is the error: 这是错误:

在此处输入图片说明

I'm new to compiling GWT apps and I've heard that compile errors are pretty common so any advice on how to debug these types of exceptions in the future would be greatly appreciated. 我是刚编译GWT应用程序的新手,而且听说编译错误非常普遍,因此,将来有关如何调试这些类型的异常的任何建议将不胜感激。 Thanks! 谢谢!

EDIT: Since I am new to these errors if I'm missing any information on how to fix this please let me know with a comment and I'll post everything I can. 编辑:由于我不熟悉这些错误,如果我缺少有关如何解决此问题的任何信息,请在评论中告知我,我将尽一切可能发布。

Since your question is little generic, here is a generic approach to debug such errors. 由于您的问题很少是通用的,因此这里是一种调试此类错误的通用方法。 I follow this apporoach to debug NoSuchClass and NoSuchMethod exception while writing Android apps; 我在编写Android应用时遵循此方法来调试NoSuchClass和NoSuchMethod异常。

  1. Make sure you are importing the correct libraries. 确保您导入了正确的库。

  2. Look at the stack trace. 查看堆栈跟踪。 If the exception appears when calling a method on an object in a library, you are most likely using separate versions of the library when compiling and running. 如果在库中的对象上调用方法时出现异常,则很可能在编译和运行时使用库的不同版本。 Make sure you have the right version both places. 确保两个地方的版本都正确。

  3. Could be caused by conflicting versions of JARs. 可能是由于JAR版本冲突造成的。

  4. NoSuchMethodError is different from NoSuchMethodException. NoSuchMethodError与NoSuchMethodException不同。 The latter is usually occurs with non-reflective code. 后者通常与非反射代码一起发生。 Do not get confused between two. 两者之间不要混淆。

In this specific case, make sure you don't mix GWT dependencies from different GWT versions. 在这种情况下,请确保不要混用来自不同GWT版本的GWT依赖项。 It's likely that you have gwt-codeserver (which is actually useless, as all classes are also in gwt-dev ) and gwt-dev from different versions. 您可能有gwt-codeserver (实际上是无用的,因为所有类也都在gwt-dev )和gwt-dev来自不同版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM