Question

ok so i have scoured this site for an answer to my problem and seen a few similar questions but none of them worked for me...

im getting this error.

04-01 16:50:52.892: E/AndroidRuntime(561): FATAL EXCEPTION: main
04-01 16:50:52.892: E/AndroidRuntime(561): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.gmaninc.andegin/com.gmaninc.andegin.Game}: java.lang.ClassNotFoundException: com.gmaninc.andegin.Game
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.os.Looper.loop(Looper.java:137)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.app.ActivityThread.main(ActivityThread.java:4340)
04-01 16:50:52.892: E/AndroidRuntime(561):  at java.lang.reflect.Method.invokeNative(Native Method)
04-01 16:50:52.892: E/AndroidRuntime(561):  at java.lang.reflect.Method.invoke(Method.java:511)
04-01 16:50:52.892: E/AndroidRuntime(561):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-01 16:50:52.892: E/AndroidRuntime(561):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-01 16:50:52.892: E/AndroidRuntime(561):  at dalvik.system.NativeStart.main(Native Method)
04-01 16:50:52.892: E/AndroidRuntime(561): Caused by: java.lang.ClassNotFoundException: com.gmaninc.andegin.Game
04-01 16:50:52.892: E/AndroidRuntime(561):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
04-01 16:50:52.892: E/AndroidRuntime(561):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
04-01 16:50:52.892: E/AndroidRuntime(561):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
04-01 16:50:52.892: E/AndroidRuntime(561):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
04-01 16:50:52.892: E/AndroidRuntime(561):  ... 11 more

i have tried unchecking library. i have uninstalled and re-installed, im using GLES2 so no jars, and the examples work just fine! so apparently there is a problem with my project itself..... have a look at some code:

package com.gmaninc.andegin;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.util.FPSLogger;
import org.andengine.opengl.font.FontFactory;
import org.andengine.ui.activity.BaseActivity;
import org.andengine.ui.activity.SimpleBaseGameActivity;

import android.graphics.Typeface;
import android.renderscript.Font;
public class Game extends SimpleBaseGameActivity {
    static final int CAMERA_WIDTH = 800;
    static final int CAMERA_HEIGHT = 480;

    public org.andengine.opengl.font.Font mFont;
    public Camera mCamera;

    //A reference to the current scene
    public Scene mCurrentScene;
    public static BaseActivity instance;
    @Override
    public EngineOptions onCreateEngineOptions() {
          instance = this;
            mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

            return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
    }
    @Override
    protected void onCreateResources() {
          mFont = FontFactory.create(this.getFontManager(),this.getTextureManager(), 256, 256,Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32);
            mFont.load();
    }
    @Override
    protected Scene onCreateScene() {
         mEngine.registerUpdateHandler(new FPSLogger());
            mCurrentScene = new Scene();
            mCurrentScene.setBackground(new Background(0.09804f, 0.7274f, 0.8f));
            return mCurrentScene;
            }
}

and my manifest

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.gmaninc.andegin.Game"
            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>

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>


    <uses-permission android:name="android.permission.INTERNET"/>


</manifest>

there is only the one activity.... i have cleaned my project several times.... the problem as i see it, is the line in the logcat that says it cant find the baseclass of Game(SimpleBaseGameActivity)

like i said the examples are working fine.... so there must be somthing i missed in my project.... any help would be appreciatted!

p.s. please dont tell me to "uncheck library" or "clean the project" as i have tried these repeatedly

Was it helpful?

Solution

ok so i finally figured it out.... i had to update my sdk, and then go into eclipse>help>check for updates.... on a side note, i could not get SimpleBaseGameActivity to work so i am Using BaseGameActivity.... if you find your way here, and it still wont work, i recomend you check out the andengine tutorials on mybringback.com.... thats where i found the solution to several andengine problems i was having.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top