如何解决"类型的层次结构是不一致的"错误在Java中的Eclipse? [英] How to solve "The hierarchy of the type is inconsistent" error in Java Eclipse?

查看:2421
本文介绍了如何解决"类型的层次结构是不一致的"错误在Java中的Eclipse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用Java创建Eclipse中使用处理的Andr​​oid版但是当我正要编译它,我得到这个错误消息类型MainAcitvity的层次结构是不一致。这里是我的code:

I was trying to create an Android Application in Java Eclipse with the use of the Processing for Android but when I was about to compile it, I got this error message "The hierarchy of the type MainAcitvity is inconsistent". Here is my code:

public class MainActivity extends PApplet {

 public static void main(String args[]) 

 {

     PApplet.main(new String[] { "--present", "com.RDP.MainActivity" });

 }

 Vector path = new Vector();

 public void setup(){

     size(550,550, P3D);
     smooth();

 }

 public void draw(){
     background(255);

     LineSimplifier1 pt;
     noFill();
     strokeWeight(1);
     beginShape();

     for (int i=0; i < path.size(); i++)

     {
         pt = (LineSimplifier1)path.elementAt(i);vertex(pt.x,pt.y);

     }

     endShape();

     strokeWeight(5);

     beginShape(POINTS);

     for (int i=0; i < path.size(); i++)

     {
         pt = (LineSimplifier1)path.elementAt(i);vertex(pt.x,pt.y);      

     }

     endShape();

 }

 public void mousePressed(){

     path = new Vector();

 }

 public void mouseDragged(){

     path.add(new LineSimplifier1(mouseX, mouseY));

 }

 public void mousePressed1(){

     if (path.size() > 1)

     {
         LineSimplifier1 [] tmp = new LineSimplifier1[path.size()-1];

         for (int i =0; i < path.size()-1; i++)

         {
             tmp[i] = (LineSimplifier1)path.elementAt(i+1);

         }

         path = new Vector();
         path.addAll(Arrays.asList(AndroidRDPActivity.simplifyLine2D(5,tmp)));

     }   
 }
}

另一个错误是,的类型java.awt.event.MouseListener不能得到解决。这是间接需要的.class文件中引用。请帮我解决这个问题。谢谢你。

Another error is, "The type java.awt.event.MouseListener cannot be resolved. It is indirectly referenced from required .class files". Please help me solve this problem. Thanks.

推荐答案

在我而言,这是由图书馆相互矛盾造成的。在控制台打印错误这样的:

In my case, this is caused by library conflicting. In console errors print like this:

[2013-04-10 21:06:38 - miaoqu-lib] Found 3 versions of android-support-v4.jar in the dependency list,
[2013-04-10 21:06:38 - miaoqu-lib] but not all the versions are identical (check is based on SHA-1 only at this time).
[2013-04-10 21:06:38 - miaoqu-lib] All versions of the libraries must be the same at this time.
[2013-04-10 21:06:38 - miaoqu-lib] Versions found are:
[2013-04-10 21:06:38 - miaoqu-lib] Path: /home/sunshine/workspace/miaoqu-lib/libs/android-support-v4.jar
[2013-04-10 21:06:38 - miaoqu-lib]  Length: 385685
[2013-04-10 21:06:38 - miaoqu-lib]  SHA-1: 48c94ae70fa65718b382098237806a5909bb096e
[2013-04-10 21:06:38 - miaoqu-lib] Path: /home/sunshine/workspace/miaoqu-lib-actionbarsherlock/libs/android-support-v4.jar
[2013-04-10 21:06:38 - miaoqu-lib]  Length: 393154
[2013-04-10 21:06:38 - miaoqu-lib]  SHA-1: 307c1cc532eabbf1d135b43e5c983c9da700449d
[2013-04-10 21:06:38 - miaoqu-lib] Path: /home/sunshine/workspace/miaoqu-lib-slidingmenu/libs/android-support-v4.jar
[2013-04-10 21:06:38 - miaoqu-lib]  Length: 393154
[2013-04-10 21:06:38 - miaoqu-lib]  SHA-1: 307c1cc532eabbf1d135b43e5c983c9da700449d
[2013-04-10 21:06:38 - miaoqu-lib] Jar mismatch! Fix your dependencies

所以我取代了 Android的支持 - v4.jar 文件的lib 通过3个项目的文件夹同样的一个,问题就解决了​​。希望这有助于。

So I replaced the android-support-v4.jar file in lib folders of the 3 project with the same one, and problem solved. Hope this helps.

这篇关于如何解决&QUOT;类型的层次结构是不一致的&QUOT;错误在Java中的Eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆