0

I have been working on Andengine for about 4months the GLES 1 was working fine. but when i installed the AndEngine GLES 2, at the runtime DDMS is showing Class not Found Exception. I tried the project with same AndroidMenifest on android, it is running... but when i am inheriting my activity with BaseGameActivity it is showing Class not found Exception. The problem is now even with GLES1.

public class CentrifeudGameActivity extends BaseGameActivity {

private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;

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

private Camera mCamera;
private BitmapTextureAtlas mBitmapTextureAtlas;
private TextureRegion mFaceTextureRegion;

@Override
public Engine onLoadEngine() {
    this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
}

@Override
public void onLoadResources() {
    this.mBitmapTextureAtlas = new BitmapTextureAtlas(32, 32, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);

    this.mEngine.getTextureManager().loadTexture(this.mBitmapTextureAtlas);
}

@Override
public Scene onLoadScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    final Scene scene = new Scene();
    scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));

    /* Calculate the coordinates for the face, so its centered on the camera. */

    final int centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
    final int centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;

    /* Create the face and add it to the scene. */
    final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion);
    scene.attachChild(face);

    return scene;
}

@Override
public void onLoadComplete() {
    // TODO Auto-generated method stub

}
}

with the Menifest code

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.folio3.games"
android:versionCode="1"
android:versionName="1.0" >

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

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".CentrifeudGameActivity"
        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>

The Exception that is occuring is as below

    05-08 10:00:42.598: E/AndroidRuntime(667): FATAL EXCEPTION: main
05-08 10:00:42.598: E/AndroidRuntime(667): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.folio3.games/com.folio3.games.CentrifeudGameActivity}: java.lang.ClassNotFoundException: com.folio3.games.CentrifeudGameActivity
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.os.Looper.loop(Looper.java:137)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.app.ActivityThread.main(ActivityThread.java:4424)
05-08 10:00:42.598: E/AndroidRuntime(667):  at java.lang.reflect.Method.invokeNative(Native Method)
05-08 10:00:42.598: E/AndroidRuntime(667):  at java.lang.reflect.Method.invoke(Method.java:511)
05-08 10:00:42.598: E/AndroidRuntime(667):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-08 10:00:42.598: E/AndroidRuntime(667):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-08 10:00:42.598: E/AndroidRuntime(667):  at dalvik.system.NativeStart.main(Native Method)
05-08 10:00:42.598: E/AndroidRuntime(667): Caused by: java.lang.ClassNotFoundException: com.folio3.games.CentrifeudGameActivity
05-08 10:00:42.598: E/AndroidRuntime(667):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-08 10:00:42.598: E/AndroidRuntime(667):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-08 10:00:42.598: E/AndroidRuntime(667):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-08 10:00:42.598: E/AndroidRuntime(667):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)

Can Anyone tell me what is the problem here! because i am just copying the sprite example but the class not found exception is making troubles.

4

3 回答 3

2

Make a new project, and copy your files into it. Usually solves these problems.

[edit] And you can not use BaseGameActivity. Use SimplebaseGameActivity. The onLoadEngine changes name to onCreateEngine and so on....

于 2012-05-08T06:29:22.493 回答
2

Add andengine as library instead of importing the project, that solved my problem

于 2012-08-02T21:09:14.263 回答
2

Had the same error after an ADT upgrade. Renaming the "lib" folder to "libs" fixed it.

于 2012-09-10T18:29:07.557 回答