好吧所以我已经搜索了这个网站以找到我的问题的答案并看到了一些类似的问题,但它们都没有为我工作......
我收到此错误。
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
我试过取消选中库。我已经卸载并重新安装,我使用GLES2所以没有罐子,这些例子工作得很好!显然我的项目本身存在问题.....看看一些代码:
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;
}
}
和我的清单
<?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>
只有一个活动....我已经多次清理了我的项目....我看到的问题是,logcat中的行说它无法找到Game的基类(SimpleBaseGameActivity)< / p> 像我说的那样,这些例子工作得很好......所以我的项目中肯定会有一些错过的东西......任何帮助都会得到赞赏!
P.S。请不要告诉我“取消选中图书馆”或“清理项目”,因为我反复试过这些
答案 0 :(得分:1)
好吧所以我终于想通了....我不得不更新我的sdk,然后进入eclipse&gt;帮助&gt;检查更新....在旁注,我无法让SimpleBaseGameActivity工作所以我我正在使用BaseGameActivity ....如果你在这里找到了自己的方式,它仍然无法工作,我建议你查看mybringback.com上的andengine教程....那就是我找到了解决了几个andengine问题的解决方案。