这一次都有效。我不知道我做了什么来杀死它。 App Force在任何事情发生之前关闭。 以下是LogCat
10-21 15:34:14.503:E / AndroidRuntime(22129):java.lang.RuntimeException:无法实例化活动ComponentInfo {com.bigtexapps.android.DropBubble / com.bigtexapps.android.DropBubble.Menu}: java.lang.ClassNotFoundException:com.bigtexapps.android.DropBubble.Menu in loader dalvik.system.PathClassLoader [/data/app/com.bigtexapps.android.DropBubble-2.apk]
以下是Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bigtexapps.android.DropBubble"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7"
android:targetSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".Menu"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DropBubble"> </activity>
<activity android:name=".Help"> </activity>
<activity android:name=".GameOver"> </activity>
</application>
</manifest>
以下是Menu.java的第一部分:
package com.bigtexapps.android.DropBubble;
import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.options.EngineOptions;
import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.menu.MenuScene;
import org.anddev.andengine.entity.scene.menu.MenuScene.IOnMenuItemClickListener;
import org.anddev.andengine.entity.scene.menu.item.IMenuItem;
import org.anddev.andengine.entity.scene.menu.item.SpriteMenuItem;
import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.opengl.texture.Texture;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.region.TextureRegion;
import org.anddev.andengine.opengl.texture.region.TextureRegionFactory;
import org.anddev.andengine.ui.activity.BaseGameActivity;
import android.content.Intent;
/**
* @author Roger Belk
*
*/
public class Menu extends BaseGameActivity implements IOnMenuItemClickListener{
// ===========================================================
// Constants
// ===========================================================
private static final int CAMERA_WIDTH = 320;
private static final int CAMERA_HEIGHT = 480;
protected static final int MENU_START = 0;
protected static final int MENU_HELP = MENU_START +1;
protected static final int MENU_QUIT = MENU_HELP + 1;
// ===========================================================
// Fields
// ===========================================================
private Camera mCamera;
private MenuScene mMenuScene;
private Scene mMainScene;
private Texture mStartBackGroundTexture;
private TextureRegion mStartBackGroundTextureRegion;
private Texture mStartGameTexture;
private TextureRegion mStartGameTextureRegion;
private TextureRegion mHelpTextureRegion;
private TextureRegion mExitTextureRegion;
public Engine onLoadEngine() {
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new Engine(new EngineOptions(true, ScreenOrientation.PORTRAIT,
new RatioResolutionPolicy(CAMERA_WIDTH,CAMERA_HEIGHT),this.mCamera));
}
public void onLoadResources() {
//To import background of resources
this.mStartBackGroundTexture = new Texture(512, 512, TextureOptions.DEFAULT);
this.mStartBackGroundTextureRegion = TextureRegionFactory.createFromAsset(this.mStartBackGroundTexture, this, "gfx/startbg.png", 0, 0);
//Import to start the game resources
this.mStartGameTexture = new Texture(256,256,TextureOptions.BILINEAR);
this.mStartGameTextureRegion = TextureRegionFactory.createFromAsset(this.mStartGameTexture, this, "gfx/menu_start.png",0,0);
this.mHelpTextureRegion = TextureRegionFactory.createFromAsset(this.mStartGameTexture, this, "gfx/menu_help.png",0,50);
this.mExitTextureRegion = TextureRegionFactory.createFromAsset(this.mStartGameTexture, this, "gfx/menu_quit.png",0,100);
this.mEngine.getTextureManager().loadTextures(this.mStartBackGroundTexture,this.mStartGameTexture);
}
public Scene onLoadScene() {
this.createMenuScene();
this.mMainScene = new Scene(1);
final int centerX = (CAMERA_WIDTH - this.mStartBackGroundTextureRegion.getWidth()) / 2;
final int centerY = (CAMERA_HEIGHT - this.mStartBackGroundTextureRegion.getHeight()) / 2;
final Sprite bg = new Sprite(centerX, centerY, this.mStartBackGroundTextureRegion);
this.mMainScene.setChildScene(this.mMenuScene, false, true, true);
this.mMainScene.getTopLayer().addEntity(bg);
return this.mMainScene;
}
答案 0 :(得分:0)
看起来你的问题在这里:
java.lang.ClassNotFoundException: com.bigtexapps.android.DropBubble.Menu
确保任何第三方jar文件都在项目的/ libs文件夹中。
在旧版本(r16及更低版本)中,处理此问题的方法是将第三方jar放入任何文件夹,然后将该文件夹添加到项目的路径中。谷歌在r17中对此进行了更改,以便将所有第三方jar文件放入/ libs中。
答案 1 :(得分:0)
我认为你没有用你的apk捆绑jar。您需要做的只是配置构建路径设置并检查eclipse中的导出选项以获取相应的jar。