2

This is the directory structure of my main project, which I'm calling from my Android project.

   src
    └── legless
        ├── entities
        │   ├── Bullet.java
        │   ├── Creep.java
        │   └── Hero.java
        ├── Game.java
        └── states
            ├── GameState.java
            └── MessageState.java

In Game.java, I instantiate a GameState object. This is the line where I get the error.

04-01 21:12:13.680: E/AndroidRuntime(12949): FATAL EXCEPTION: GLThread 10
04-01 21:12:13.680: E/AndroidRuntime(12949): java.lang.NoClassDefFoundError: legless.states.GameState
04-01 21:12:13.680: E/AndroidRuntime(12949):    at legless.Game.initStatesList(Game.java:22)
04-01 21:12:13.680: E/AndroidRuntime(12949):    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
04-01 21:12:13.680: E/AndroidRuntime(12949):    at org.newdawn.slick.GDXGameContainer.create(GDXGameContainer.java:135)
04-01 21:12:13.680: E/AndroidRuntime(12949):    at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:265)
04-01 21:12:13.680: E/AndroidRuntime(12949):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1356)
04-01 21:12:13.680: E/AndroidRuntime(12949):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

If required, AndroidManifest.xml looks like this,

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="yasith.legless"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".LeglessRunnerAndroid"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

I tried removing the "." in "<activity android:name=". It didn't change anything.

Any help would be greatly appreciated.

4

1 回答 1

1

您最近升级到 ADT 17 了吗?如果是这样,请参阅: http ://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

如果不是,这是否曾经有效或从未对您有效?

于 2012-04-03T08:21:23.803 回答