我的代码PhysicsRemoveExample.java(AndEngine)有什么问题?
尝试从 此处。
程序启动时收到此消息:
Sorry! The application PhysicsRemoveExample(process org.anddev.andengine.PhysicsRemoveExample) has stopped unexpectedly. Please try again.
我有构建路径 andengine.jar
和 andenginephysicalsbox2dextension.jar
资产/gfx -> face_box_tiled.png 和 face_circle_tiled.png
。
这是我在 PhysicsRemoveExample.java
中的 Java 代码。与示例中相同,但我已更改为 extends BaseGameActivity
。
package org.anddev.andengine.PhysicsRemoveExample;
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.primitive.Rectangle;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.Scene.IOnAreaTouchListener;
import org.anddev.andengine.entity.scene.Scene.IOnSceneTouchListener;
import org.anddev.andengine.entity.scene.Scene.ITouchArea;
import org.anddev.andengine.entity.scene.background.ColorBackground;
import org.anddev.andengine.entity.shape.Shape;
import org.anddev.andengine.entity.sprite.AnimatedSprite;
import org.anddev.andengine.entity.util.FPSLogger;
import org.anddev.andengine.extension.physics.box2d.PhysicsConnector;
import org.anddev.andengine.extension.physics.box2d.PhysicsFactory;
import org.anddev.andengine.extension.physics.box2d.PhysicsWorld;
import org.anddev.andengine.input.touch.TouchEvent;
import org.anddev.andengine.opengl.texture.Texture;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.region.TextureRegionFactory;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;
import org.anddev.andengine.sensor.accelerometer.AccelerometerData;
import org.anddev.andengine.sensor.accelerometer.IAccelerometerListener;
import org.anddev.andengine.ui.activity.BaseGameActivity;
import android.hardware.SensorManager;
import android.widget.Toast;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
/**
* @author Nicolas Gramlich
* @since 18:47:08 - 19.03.2010
*/
public class PhysicsRemoveExample extends BaseGameActivity implements IAccelerometerListener, IOnSceneTouchListener, IOnAreaTouchListener {
// ===========================================================
// Constants
// ===========================================================
private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;
// ===========================================================
// Fields
// ===========================================================
private Texture mTexture;
private TiledTextureRegion mBoxFaceTextureRegion;
private TiledTextureRegion mCircleFaceTextureRegion;
private PhysicsWorld mPhysicsWorld;
private int mFaceCount = 0;
private final Vector2 mTempVector = new Vector2();
// ===========================================================
// Constructors
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public Engine onLoadEngine() {
Toast.makeText(this, "Touch the screen to add objects. Touch an object to remove it.", Toast.LENGTH_LONG).show();
final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
engineOptions.getTouchOptions().setRunOnUpdateThread(true);
return new Engine(engineOptions);
}
@Override
public void onLoadResources() {
this.mTexture = new Texture(64, 64, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
TextureRegionFactory.setAssetBasePath("gfx/");
this.mBoxFaceTextureRegion = TextureRegionFactory.createTiledFromAsset(this.mTexture, this, "face_box_tiled.png", 0, 0, 2, 1); // 64x32
this.mCircleFaceTextureRegion = TextureRegionFactory.createTiledFromAsset(this.mTexture, this, "face_circle_tiled.png", 0, 32, 2, 1); // 64x32
this.mEngine.getTextureManager().loadTexture(this.mTexture);
this.enableAccelerometerSensor(this);
}
@Override
public Scene onLoadScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
final Scene scene = new Scene(2);
scene.setBackground(new ColorBackground(0, 0, 0));
scene.setOnSceneTouchListener(this);
this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY_EARTH), false);
final Shape ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2);
final Shape roof = new Rectangle(0, 0, CAMERA_WIDTH, 2);
final Shape left = new Rectangle(0, 0, 2, CAMERA_HEIGHT);
final Shape right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT);
final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, left, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, right, BodyType.StaticBody, wallFixtureDef);
scene.getBottomLayer().addEntity(ground);
scene.getBottomLayer().addEntity(roof);
scene.getBottomLayer().addEntity(left);
scene.getBottomLayer().addEntity(right);
scene.registerUpdateHandler(this.mPhysicsWorld);
scene.setOnAreaTouchListener(this);
return scene;
}
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
PhysicsRemoveExample.this.removeFace((AnimatedSprite)pTouchArea);
return true;
}
return false;
}
public void onLoadComplete() {
}
@Override
public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) {
if(this.mPhysicsWorld != null) {
if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
this.addFace(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
return true;
}
}
return false;
}
@Override
public void onAccelerometerChanged(final AccelerometerData pAccelerometerData) {
this.mTempVector.set(pAccelerometerData.getY(), pAccelerometerData.getX());
this.mPhysicsWorld.setGravity(this.mTempVector);
}
// ===========================================================
// Methods
// ===========================================================
private void addFace(final float pX, final float pY) {
final Scene scene = this.mEngine.getScene();
this.mFaceCount++;
final AnimatedSprite face;
final Body body;
final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(1, 0.5f, 0.5f);
if(this.mFaceCount % 2 == 0) {
face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion);
body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face, BodyType.DynamicBody, objectFixtureDef);
} else {
face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion);
body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face, BodyType.DynamicBody, objectFixtureDef);
}
face.animate(200, true);
face.setUpdatePhysics(false);
scene.registerTouchArea(face);
scene.getTopLayer().addEntity(face);
this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, body, true, true, false, false));
}
private void removeFace(final AnimatedSprite face) {
final Scene scene = this.mEngine.getScene();
final PhysicsConnector facePhysicsConnector = this.mPhysicsWorld.getPhysicsConnectorManager().findPhysicsConnectorByShape(face);
this.mPhysicsWorld.unregisterPhysicsConnector(facePhysicsConnector);
this.mPhysicsWorld.destroyBody(facePhysicsConnector.getBody());
scene.unregisterTouchArea(face);
scene.getTopLayer().removeEntity(face);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
我在 LogCat 中收到此错误:
11-12 20:31:39.482: ERROR/vold(27): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
11-12 20:31:39.482: ERROR/vold(27): Error bootstrapping switch '/sys/class/switch/test' (No such file or directory)
11-12 20:31:39.482: ERROR/vold(27): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
11-12 20:31:39.482: ERROR/vold(27): Error bootstrapping switch '/sys/class/switch/test2' (No such file or directory)
11-12 20:31:55.381: ERROR/BatteryService(52): usbOnlinePath not found
11-12 20:31:55.381: ERROR/BatteryService(52): batteryVoltagePath not found
11-12 20:31:55.381: ERROR/BatteryService(52): batteryTemperaturePath not found
11-12 20:31:55.401: ERROR/SurfaceFlinger(52): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
11-12 20:32:01.131: ERROR/EventHub(52): could not get driver version for /dev/input/mouse0, Not a typewriter
11-12 20:32:01.131: ERROR/EventHub(52): could not get driver version for /dev/input/mice, Not a typewriter
11-12 20:32:01.351: ERROR/System(52): Failure starting core service
11-12 20:32:01.351: ERROR/System(52): java.lang.SecurityException
11-12 20:32:01.351: ERROR/System(52): at android.os.BinderProxy.transact(Native Method)
11-12 20:32:01.351: ERROR/System(52): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
11-12 20:32:01.351: ERROR/System(52): at android.os.ServiceManager.addService(ServiceManager.java:72)
11-12 20:32:01.351: ERROR/System(52): at com.android.server.ServerThread.run(SystemServer.java:176)
11-12 20:32:01.361: ERROR/AndroidRuntime(52): Crash logging skipped, no checkin service
11-12 20:32:12.683: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
11-12 20:32:15.853: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
11-12 20:32:16.183: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
11-12 20:32:17.303: ERROR/MediaPlayerService(31): Couldn't open fd for content://settings/system/notification_sound
11-12 20:32:17.313: ERROR/MediaPlayer(52): Unable to to create media player
11-12 20:32:23.833: ERROR/AndroidRuntime(135): ERROR: thread attach failed
11-12 20:32:32.292: ERROR/AndroidRuntime(178): ERROR: thread attach failed
11-12 20:32:59.373: ERROR/AndroidRuntime(225): Uncaught handler: thread main exiting due to uncaught exception
11-12 20:32:59.533: ERROR/AndroidRuntime(225): java.lang.ExceptionInInitializerError
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.PhysicsRemoveExample.PhysicsRemoveExample.onLoadScene(PhysicsRemoveExample.java:125)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.ui.activity.BaseGameActivity.doResume(BaseGameActivity.java:159)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.ui.activity.BaseGameActivity.onWindowFocusChanged(BaseGameActivity.java:83)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:1969)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.view.View.dispatchWindowFocusChanged(View.java:3731)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:657)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.view.ViewRoot.handleMessage(ViewRoot.java:1819)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.os.Handler.dispatchMessage(Handler.java:99)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.os.Looper.loop(Looper.java:123)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.reflect.Method.invokeNative(Native Method)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.reflect.Method.invoke(Method.java:521)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at dalvik.system.NativeStart.main(Native Method)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): Caused by: java.lang.UnsatisfiedLinkError: Library andenginephysicsbox2dextension not found
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.Runtime.loadLibrary(Runtime.java:489)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.System.loadLibrary(System.java:557)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.extension.physics.box2d.PhysicsWorld.<clinit>(PhysicsWorld.java:30)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): ... 15 more
11-12 20:32:59.603: ERROR/dalvikvm(225): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
出了什么问题?尝试过模拟器 1.6 和 2.1 并创建了一个全新的 AVD。 我可以做 入门教程(视频 - 5 分钟)没有任何问题。
Trying to make the example PhysicsRemoveExample.java
from here.
I get this message when the program starts:
Sorry! The application PhysicsRemoveExample(process org.anddev.andengine.PhysicsRemoveExample) has stopped unexpectedly. Please try again.
I have Build Path andengine.jar
and andenginephysicsbox2dextension.jar
assets/gfx -> face_box_tiled.png
and face_circle_tiled.png
.
This is my Java code in PhysicsRemoveExample.java
. Same as in the example, though I have changed to extends BaseGameActivity
.
package org.anddev.andengine.PhysicsRemoveExample;
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.primitive.Rectangle;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.Scene.IOnAreaTouchListener;
import org.anddev.andengine.entity.scene.Scene.IOnSceneTouchListener;
import org.anddev.andengine.entity.scene.Scene.ITouchArea;
import org.anddev.andengine.entity.scene.background.ColorBackground;
import org.anddev.andengine.entity.shape.Shape;
import org.anddev.andengine.entity.sprite.AnimatedSprite;
import org.anddev.andengine.entity.util.FPSLogger;
import org.anddev.andengine.extension.physics.box2d.PhysicsConnector;
import org.anddev.andengine.extension.physics.box2d.PhysicsFactory;
import org.anddev.andengine.extension.physics.box2d.PhysicsWorld;
import org.anddev.andengine.input.touch.TouchEvent;
import org.anddev.andengine.opengl.texture.Texture;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.region.TextureRegionFactory;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;
import org.anddev.andengine.sensor.accelerometer.AccelerometerData;
import org.anddev.andengine.sensor.accelerometer.IAccelerometerListener;
import org.anddev.andengine.ui.activity.BaseGameActivity;
import android.hardware.SensorManager;
import android.widget.Toast;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
/**
* @author Nicolas Gramlich
* @since 18:47:08 - 19.03.2010
*/
public class PhysicsRemoveExample extends BaseGameActivity implements IAccelerometerListener, IOnSceneTouchListener, IOnAreaTouchListener {
// ===========================================================
// Constants
// ===========================================================
private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;
// ===========================================================
// Fields
// ===========================================================
private Texture mTexture;
private TiledTextureRegion mBoxFaceTextureRegion;
private TiledTextureRegion mCircleFaceTextureRegion;
private PhysicsWorld mPhysicsWorld;
private int mFaceCount = 0;
private final Vector2 mTempVector = new Vector2();
// ===========================================================
// Constructors
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public Engine onLoadEngine() {
Toast.makeText(this, "Touch the screen to add objects. Touch an object to remove it.", Toast.LENGTH_LONG).show();
final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
engineOptions.getTouchOptions().setRunOnUpdateThread(true);
return new Engine(engineOptions);
}
@Override
public void onLoadResources() {
this.mTexture = new Texture(64, 64, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
TextureRegionFactory.setAssetBasePath("gfx/");
this.mBoxFaceTextureRegion = TextureRegionFactory.createTiledFromAsset(this.mTexture, this, "face_box_tiled.png", 0, 0, 2, 1); // 64x32
this.mCircleFaceTextureRegion = TextureRegionFactory.createTiledFromAsset(this.mTexture, this, "face_circle_tiled.png", 0, 32, 2, 1); // 64x32
this.mEngine.getTextureManager().loadTexture(this.mTexture);
this.enableAccelerometerSensor(this);
}
@Override
public Scene onLoadScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
final Scene scene = new Scene(2);
scene.setBackground(new ColorBackground(0, 0, 0));
scene.setOnSceneTouchListener(this);
this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY_EARTH), false);
final Shape ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2);
final Shape roof = new Rectangle(0, 0, CAMERA_WIDTH, 2);
final Shape left = new Rectangle(0, 0, 2, CAMERA_HEIGHT);
final Shape right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT);
final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, left, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, right, BodyType.StaticBody, wallFixtureDef);
scene.getBottomLayer().addEntity(ground);
scene.getBottomLayer().addEntity(roof);
scene.getBottomLayer().addEntity(left);
scene.getBottomLayer().addEntity(right);
scene.registerUpdateHandler(this.mPhysicsWorld);
scene.setOnAreaTouchListener(this);
return scene;
}
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
PhysicsRemoveExample.this.removeFace((AnimatedSprite)pTouchArea);
return true;
}
return false;
}
public void onLoadComplete() {
}
@Override
public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) {
if(this.mPhysicsWorld != null) {
if(pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
this.addFace(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
return true;
}
}
return false;
}
@Override
public void onAccelerometerChanged(final AccelerometerData pAccelerometerData) {
this.mTempVector.set(pAccelerometerData.getY(), pAccelerometerData.getX());
this.mPhysicsWorld.setGravity(this.mTempVector);
}
// ===========================================================
// Methods
// ===========================================================
private void addFace(final float pX, final float pY) {
final Scene scene = this.mEngine.getScene();
this.mFaceCount++;
final AnimatedSprite face;
final Body body;
final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(1, 0.5f, 0.5f);
if(this.mFaceCount % 2 == 0) {
face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion);
body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face, BodyType.DynamicBody, objectFixtureDef);
} else {
face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion);
body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face, BodyType.DynamicBody, objectFixtureDef);
}
face.animate(200, true);
face.setUpdatePhysics(false);
scene.registerTouchArea(face);
scene.getTopLayer().addEntity(face);
this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, body, true, true, false, false));
}
private void removeFace(final AnimatedSprite face) {
final Scene scene = this.mEngine.getScene();
final PhysicsConnector facePhysicsConnector = this.mPhysicsWorld.getPhysicsConnectorManager().findPhysicsConnectorByShape(face);
this.mPhysicsWorld.unregisterPhysicsConnector(facePhysicsConnector);
this.mPhysicsWorld.destroyBody(facePhysicsConnector.getBody());
scene.unregisterTouchArea(face);
scene.getTopLayer().removeEntity(face);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
And I get this error in LogCat:
11-12 20:31:39.482: ERROR/vold(27): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
11-12 20:31:39.482: ERROR/vold(27): Error bootstrapping switch '/sys/class/switch/test' (No such file or directory)
11-12 20:31:39.482: ERROR/vold(27): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
11-12 20:31:39.482: ERROR/vold(27): Error bootstrapping switch '/sys/class/switch/test2' (No such file or directory)
11-12 20:31:55.381: ERROR/BatteryService(52): usbOnlinePath not found
11-12 20:31:55.381: ERROR/BatteryService(52): batteryVoltagePath not found
11-12 20:31:55.381: ERROR/BatteryService(52): batteryTemperaturePath not found
11-12 20:31:55.401: ERROR/SurfaceFlinger(52): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
11-12 20:32:01.131: ERROR/EventHub(52): could not get driver version for /dev/input/mouse0, Not a typewriter
11-12 20:32:01.131: ERROR/EventHub(52): could not get driver version for /dev/input/mice, Not a typewriter
11-12 20:32:01.351: ERROR/System(52): Failure starting core service
11-12 20:32:01.351: ERROR/System(52): java.lang.SecurityException
11-12 20:32:01.351: ERROR/System(52): at android.os.BinderProxy.transact(Native Method)
11-12 20:32:01.351: ERROR/System(52): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
11-12 20:32:01.351: ERROR/System(52): at android.os.ServiceManager.addService(ServiceManager.java:72)
11-12 20:32:01.351: ERROR/System(52): at com.android.server.ServerThread.run(SystemServer.java:176)
11-12 20:32:01.361: ERROR/AndroidRuntime(52): Crash logging skipped, no checkin service
11-12 20:32:12.683: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
11-12 20:32:15.853: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
11-12 20:32:16.183: ERROR/ActivityThread(103): Failed to find provider info for android.server.checkin
11-12 20:32:17.303: ERROR/MediaPlayerService(31): Couldn't open fd for content://settings/system/notification_sound
11-12 20:32:17.313: ERROR/MediaPlayer(52): Unable to to create media player
11-12 20:32:23.833: ERROR/AndroidRuntime(135): ERROR: thread attach failed
11-12 20:32:32.292: ERROR/AndroidRuntime(178): ERROR: thread attach failed
11-12 20:32:59.373: ERROR/AndroidRuntime(225): Uncaught handler: thread main exiting due to uncaught exception
11-12 20:32:59.533: ERROR/AndroidRuntime(225): java.lang.ExceptionInInitializerError
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.PhysicsRemoveExample.PhysicsRemoveExample.onLoadScene(PhysicsRemoveExample.java:125)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.ui.activity.BaseGameActivity.doResume(BaseGameActivity.java:159)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.ui.activity.BaseGameActivity.onWindowFocusChanged(BaseGameActivity.java:83)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:1969)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.view.View.dispatchWindowFocusChanged(View.java:3731)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:657)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.view.ViewRoot.handleMessage(ViewRoot.java:1819)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.os.Handler.dispatchMessage(Handler.java:99)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.os.Looper.loop(Looper.java:123)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.reflect.Method.invokeNative(Native Method)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.reflect.Method.invoke(Method.java:521)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at dalvik.system.NativeStart.main(Native Method)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): Caused by: java.lang.UnsatisfiedLinkError: Library andenginephysicsbox2dextension not found
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.Runtime.loadLibrary(Runtime.java:489)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at java.lang.System.loadLibrary(System.java:557)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): at org.anddev.andengine.extension.physics.box2d.PhysicsWorld.<clinit>(PhysicsWorld.java:30)
11-12 20:32:59.533: ERROR/AndroidRuntime(225): ... 15 more
11-12 20:32:59.603: ERROR/dalvikvm(225): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
What is wrong? Have tried with emulator 1.6 and 2.1 and created a whole new AVD.
I could do the Getting Started Tutorial (Video – 5 minutes) without any problems.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
检查 libandenginephysicalbox2dextension.so 文件是否位于您的 libs/armeabi 文件夹中
Check if libandenginephysicsbox2dextension.so file is in your libs/armeabi folder
这就是我为使物理原理在 Eclipse 中发挥作用所做的工作:::
1。
运行并安装:
Mercurial-2.1.exe
Mercurial-2.1 为您提供 HG 命令工具。
在命令(DOS)提示符下使用hg工具获取最新的AndEngine
和enginephysicalbox2扩展。使用以下hg命令>
hg 克隆 https://code.google.com/p/andenginephysicalsbox2dextension/
hg 克隆 https://andengine.googlecode.com/hg/ 和engine
这将下载这两个项目。将它们导入 Eclipse 中。
使用文件->导入->现有项目进入工作区 ->选择根目录->浏览
找到使用hg命令下载的AndEngine项目。
对 andenginephysicalsbox2dextension 项目执行相同的操作 - 这样您将有两个库项目
在 Eclipse 中。
您可能需要右键单击该项目并将“项目构建目标”设置为
安卓2.3。您可能还需要在项目的根目录中创建一个 res 和 gen 文件夹。
确保项目已编译。
右键单击项目并选择导出 ->在 Java 下选择“jar 文件”选项。
单击“下一步”。
取消选中右侧窗格中的所有内容 - AndroidManifest.xml 以及其中的其他所有内容都在哪里
列表取消选中它。指定 .jar 文件的位置,例如,如果您正在编译 AndEngine.jar
您可以输入:C:\temp\andengine.jar
在jar文件输入框中。单击“完成”- 它应该可以编译。
转到此站点:
http://code.google.com/p/andenginephysicalsbox2dextension/source/browse/libs/?name=ed03082d4a&r=38406ae958c5f5ed89e2e73e9e71385c242e8e28#libs%2Farmeabi-v7a%253Fstate%253Dlated
下载这两个 .所以这些文件需要进入:
阿尔梅阿比
armeabi-v7a
.so 文件 --- 在根目录下创建一个名为 libs 的文件夹。
在 libs 文件夹下创建两个文件夹armeabi 和armeabi-v7a——.so 文件位于这两个文件夹中。
This is what I did to get the physics working in Eclipse:::
1.
Run and install:
Mercurial-2.1.exe
The Mercurial-2.1 gives you the HG command tool.
Use the hg tool at the command(DOS) prompt to obtain the latest AndEngine
and andenginephysicsbox2dextension. Use the following hg commands>
hg clone https://code.google.com/p/andenginephysicsbox2dextension/
hg clone https://andengine.googlecode.com/hg/ andengine
This will download the two projects. Import them into Eclipse.
Use FILE -> Import -> Existing projects into workspace -> select root directory -> BROWSE
Find the AndEngine project downloaded with the hg command.
Do the same for the andenginephysicsbox2dextension project - so you will have two library projects
in Eclipse.
You will probably have to right-click on the project and set "Project Build target" to
Android 2.3. You will also probably need to create a res and gen folder in the root of the project.
Make sure the project is compiled.
Right-click project and choose Export -> under Java select the "jar file" option.
Click NEXT.
UNTICK EVERYTHING in the right hand pane - where is says AndroidManifest.xml and everything else in that
list uncheck it. specify a location for the .jar file for example if you are compiling the AndEngine.jar
you might enter : C:\temp\andengine.jar
in the jar file input box. Click FINISH - it should compile.
Goto to this site:
http://code.google.com/p/andenginephysicsbox2dextension/source/browse/libs/?name=ed03082d4a&r=38406ae958c5f5ed89e2e73e9e71385c242e8e28#libs%2Farmeabi-v7a%253Fstate%253Dclosed
Download the two .so files these will need to go into :
armeabi
armeabi-v7a
The .so files --- create a folder called libs off the root.
Under the libs folder create two folders armeabi AND armeabi-v7a -- The .so files go in these two folders.
只需从 andengine 示例项目中复制“libs”文件(而不是“lib”文件)并将其粘贴到您的项目中。
just copy the "libs" file -not the "lib" file- from the andengine examples project and paste it into your project.
并将旧的 andengine.jar 和enginephysicalsbox2dextension.jar 删除。
并从 andengine 示例项目复制“lib”和“libs”文件夹并将其粘贴到您的项目中。并添加 lib 内部 jar 文件添加到构建路径
And Old andengine.jar andenginephysicsbox2dextension.jar remvove.
And copy the "lib" and "libs" folder - from the andengine examples project and paste it into your project.and add lib inner jar file Add to build path
我面临着同样的问题,并且无法对发生的问题做任何事情。一次又一次。
啊,终于我能够解决这个问题并想分享了,因为一定有可能有大量的头发松散:)
我只是将尼古拉斯回购协议中的一根替换为 RealMayo 回购协议。下面是链接
https://github.com/RealMayo/AndEnginePhysicsBox2DExtension。
请告诉我。
:)
快乐编码。
I was facing the same problem and was not able to do any thing with this problem occurring. again and again.
Ahh at last I was able to solve the problem and want to share because there must be may whop must have loose tonns of there hairs :)
I just replace the one from nicolas repo to RealMayo repo. Below is the link
https://github.com/RealMayo/AndEnginePhysicsBox2DExtension.
Please let me know.
:)
Happy coding.