2012-01-01 63 views
1

我一直從AndEngine項目克隆庫後,收到此錯誤..枚舉類型是不通用的錯誤克隆andengine

的類型枚舉不是通用的;它不能與參數進行參數<BoundsSplit>

這裏就是錯誤仍然存​​在的類。

package org.andengine.util.spatial.adt.bounds; //The error points at the beginning of this line. 
import org.andengine.util.exception.AndEngineException; 

/** 
* (c) Zynga 2011 
* 
* @author Nicolas Gramlich <[email protected]> 
* @since 21:13:32 - 11.10.2011 
*/ 
public enum BoundsSplit { 
// =========================================================== 
// Elements 
// =========================================================== 

TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT; 

// =========================================================== 
// Constants 
// =========================================================== 

// =========================================================== 
// Fields 
// =========================================================== 

// =========================================================== 
// Constructors 
// =========================================================== 

// =========================================================== 
// Getter & Setter 
// =========================================================== 

// =========================================================== 
// Methods for/from SuperClass/Interfaces 
// =========================================================== 

// =========================================================== 
// Methods 
// =========================================================== 

// =========================================================== 
// Inner and Anonymous Classes 
// =========================================================== 

public static class BoundsSplitException extends AndEngineException { 
    // =========================================================== 
    // Constants 
    // =========================================================== 

    private static final long serialVersionUID = 7970869239897412727L; 

    // =========================================================== 
    // Fields 
    // =========================================================== 

    // =========================================================== 
    // Constructors 
    // =========================================================== 

    // =========================================================== 
    // Getter & Setter 
    // =========================================================== 

    // =========================================================== 
    // Methods for/from SuperClass/Interfaces 
    // =========================================================== 

    // =========================================================== 
    // Methods 
    // =========================================================== 

    // =========================================================== 
    // Inner and Anonymous Classes 
    // =========================================================== 
} 

}

編輯:

這裏更多的是對什麼錯誤說

Multiple markers at this line 
- The type java.lang.Enum cannot be resolved. It is indirectly referenced from 
required .class files 
- The type Enum is not generic; it cannot be parameterized with arguments 
<BoundsSplit> 
- The type java.lang.Object cannot be resolved. It is indirectly referenced from 
required .class files 
- The type java.lang.Enum cannot be resolved. It is indirectly referenced from 
required .class files 
+0

當你聲明Java中的'enum'中的成員,在那個'enum'中聲明合適的構造函數是強制性的,無論你是否明確地聲明它是'private',都是*'always'''''。你在'enum'中提供了一個合適的構造函數嗎? – Lion 2012-01-01 19:02:58

+0

我所做的只是從https://github.com/twalkerjr22/AndEngine克隆一個存儲庫,並且錯誤不斷出現。我從來沒有得到過它。 – 2012-01-01 19:06:04

+0

查看我剛添加的新編輯 – 2012-01-01 19:25:46

回答

4

好了,似乎這個錯誤有多方面的原因。搜索網頁(Here)的主要原因是項目目錄中的.classpath文件錯誤 - 我也是這樣。這可能是AndEngine的項目有錯誤的文件,因爲您說在更新它時遇到了這個問題。

所以,你可以:

  1. 解決它。 This頁面對問題有一個很好的解釋,請檢查一下。你可以得到更多的信息here
  2. 而不是在eclipse中導入AndEngine源代碼到你的工作空間(我猜你是這樣做的,因爲這可能是問題的根源),你可以鏈接源文件夾,然後eclipse不會檢查AndEngine項目文件這可能是錯誤的)。

另一個原因可能是因爲錯誤配置的JRE系統庫。有一個很好的教程,如何解決這個問題here

順便說一句,這個問題是偏食有關,所以我會用eclipse標籤重新標記您的問題,所以如果我的回答不會幫助 - 至少你會得到更好的:)

+0

Dude!我發誓你是一個LIFESAVER!關於JRE系統庫丟失的最後一個鏈接!!謝謝! – 2012-01-01 20:03:53

+0

很高興能幫到:) – Jong 2012-01-01 20:09:48

+0

還有一個問題,我們是否想用新的AndEngine GLES2作爲jar或圖書館?如果是的話,我們如何使用它作爲圖書館? http://www.andengine.org/forums/gles2/use-andengine-as-a-android-library-project-not-as-a-jar-t6142.html – 2012-01-01 20:12:37