我新的Eclipse和想知道如何把這個消息不幸的是應用程序的名稱已停止
不幸的是應用程序的名稱已停止
從顯示每次我跑在我的AVD我的測試應用時間。我試圖做一個LineView佈局和Eclipse顯示沒有錯誤。那麼我該如何解決這個問題?如果Eclipse顯示沒有問題,我該如何找出問題所在?
(這是我的logcat複印件)
12-23 06:51:56.591: D/AndEngine(2754): MenuActivity.onCreate @(Thread: 'main')
12-23 06:51:56.641: D/dalvikvm(2754): Trying to load lib /data/app- lib/com.electricpunch.beetlesmasher-1/libandengine.so 0xb3cffc08
12-23 06:51:56.651: D/dalvikvm(2754): Added shared lib /data/app- lib/com.electricpunch.beetlesmasher-1/libandengine.so 0xb3cffc08
12-23 06:51:56.651: D/dalvikvm(2754): No JNI_OnLoad found in /data/app-lib/com.electricpunch.beetlesmasher-1/libandengine.so 0xb3cffc08, skipping init
12-23 06:51:56.831: D/AndEngine(2754): MenuActivity.onResume @(Thread: 'main')
12-23 06:51:57.151: W/dalvikvm(2754): threadid=14: thread exiting with uncaught exception (group=0xb3a39ba8)
12-23 06:51:57.161: E/AndroidRuntime(2754): FATAL EXCEPTION: GLThread 90
12-23 06:51:57.161: E/AndroidRuntime(2754): Process: com.electricpunch.beetlesmasher, PID: 2754
12-23 06:51:57.161: E/AndroidRuntime(2754): java.lang.IllegalArgumentException: No EGLConfig found!
12-23 06:51:57.161: E/AndroidRuntime(2754): at org.andengine.opengl.view.ConfigChooser.chooseConfig(ConfigChooser.java:229)
12-23 06:51:57.161: E/AndroidRuntime(2754): at org.andengine.opengl.view.ConfigChooser.chooseConfig(ConfigChooser.java:203)
12-23 06:51:57.161: E/AndroidRuntime(2754): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
12-23 06:51:57.161: E/AndroidRuntime(2754): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
12-23 06:51:57.161: E/AndroidRuntime(2754): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
12-23 06:51:57.311: I/Choreographer(2754): Skipped 93 frames! The application may be doing too much work on its main thread.
12-23 06:51:57.481: D/gralloc_goldfish(2754): Emulator without GPU emulation detected.
12-23 06:51:58.161: D/AndEngine(2754): MenuActivity.onPause @(Thread: 'main')
12-23 06:52:01.171: D/AndEngine(2754): MenuActivity.onDestroy @(Thread: 'main')
12-23 06:52:02.871: D/AndEngine(2754): UpdateThread interrupted. Don't worry - this EngineDestroyedException is most likely expected!
12-23 06:52:02.871: D/AndEngine(2754): org.andengine.engine.Engine$EngineDestroyedException
12-23 06:52:02.871: D/AndEngine(2754): at org.andengine.engine.Engine.throwOnDestroyed(Engine.java:594)
12-23 06:52:02.871: D/AndEngine(2754): at org.andengine.engine.Engine.onTickUpdate(Engine.java:580)
12-23 06:52:02.871: D/AndEngine(2754): at org.andengine.engine.Engine$UpdateThread.run(Engine.java:858)
12-23 06:52:04.591: D/AndEngine(2754): MenuActivity.onDestroyResources @(Thread: 'main')
12-23 06:52:04.591: D/AndEngine(2754): MenuActivity.onGameDestroyed @(Thread: 'main')
12-23 06:52:04.961: I/Process(2754): Sending signal. PID: 2754 SIG: 9
(這是我的AndroidManifest.xml複印件)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.electricpunch.beetlesmasher"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="4323000"/>
<activity
android:name="com.electricpunch.beetlesmasher.MenuActivity"
android:configChanges="orientation"
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="com.electricpunch.beetlesmasher.SplashScreenActivity"
android:configChanges="orientation"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ALTERNATIVE" />
</intent-filter>
</activity>
<activity
android:name="com.electricpunch.beetlesmasher.GameActivity"
android:configChanges="orientation"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ALTERNATIVE" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.appstate.APP_ID"
android:value="@string/app_id" />
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
(這是我的MenuActivity.java複印件)
package com.electricpunch.beetlesmasher;
import java.io.IOException;
import org.andengine.audio.music.Music;
import org.andengine.audio.music.MusicFactory;
import org.andengine.audio.sound.Sound;
import org.andengine.audio.sound.SoundFactory;
import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.SpriteBackground;
import org.andengine.entity.sprite.Sprite;
import org.andengine.entity.text.Text;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.font.Font;
import org.andengine.opengl.font.FontFactory;
import org.andengine.opengl.texture.ITexture;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.ui.activity.BaseGameActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import com.electricpunch.beetlesmasher.R;
import com.electricpunch.beetlesmasher.other.Prefs;
import com.electricpunch.beetlesmasher.other.Tags;
import com.electricpunch.beetlesmasher.other.TextButton;
import com.google.android.gms.games.Games;
import com.googlesamples.gameutils.GameHelper;
import com.googlesamples.gameutils.GameHelper.GameHelperListener;
public class MenuActivity extends SplashScreenActivity {
Camera mCamera;
BitmapTextureAtlas mBGAtlas, mWindowAtlas, mButtonAtlas, mSoundButtonAtlas,
mCrossAtlas, mLeaderboardAtlas;
ITextureRegion mBGTextureRegion, mWindowTextureRegion,
mButtonTextureRegion, mSoundButtonTextureRegion,
mCrossTextureRegion, mLeaderboardTextureRegion;
Font headFont, menuFont;
Sound clickSound;
Music music;
Sprite cross;
SharedPreferences mSettings;
Boolean useGooglePlayServices = false;
GameHelper mGameHelper; //needed for leaderbord
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!useGooglePlayServices)
return;
// create game helper with all APIs (Games, Plus, AppState):
mGameHelper = new GameHelper(this, GameHelper.CLIENT_ALL);
// enable debug logs (if applicable)
GameHelperListener listener = new GameHelper.GameHelperListener() {
@Override
public void onSignInSucceeded() {
ShowLeaderboard();
}
@Override
public void onSignInFailed() {
// handle sign-in failure (e.g. show Sign In button)
}
};
mGameHelper.setup(listener);
}
void ShowLeaderboard() {
if (getHighScore() > 0)
setHighScore(getHighScore());
startActivityForResult(Games.Leaderboards.getLeaderboardIntent
(mGameHelper.getApiClient(), getString
(R.string.leaderboard)), 0);
}
@Override
protected void onStart() {
super.onStart();
if (useGooglePlayServices)
mGameHelper.onStart(this);
}
@Override
protected void onStop() {
super.onStop();
if (useGooglePlayServices)
mGameHelper.onStop();
}
void setHighScore(int score) {
if (mGameHelper.isSignedIn()) //if user is signed in - new highscore will be addeds
Games.Leaderboards.submitScore(mGameHelper.getApiClient(), getString(R.string.leaderboard), score);
}
public int getHighScore() {
return mSettings.getInt("score", 0);
}
@Override
protected void onActivityResult(int request, int response, Intent data) {
super.onActivityResult(request, response, data);
mGameHelper.onActivityResult(request, response, data);
}
@Override
public EngineOptions onCreateEngineOptions() {
mCamera = new Camera(0, 0, Prefs.cameraWidth, Prefs.cameraHeight);
EngineOptions engineOptions = new EngineOptions(true,
ScreenOrientation.PORTRAIT_FIXED, new FillResolutionPolicy(),
mCamera);
engineOptions.getRenderOptions().setDithering(true);
engineOptions.getAudioOptions().setNeedsSound(true);
engineOptions.getAudioOptions().setNeedsMusic(true);
return engineOptions;
}
@Override
public void onBackPressed() {
if (!isFinishing())
finish();
}
@Override
public void onPopulateScene(Scene pScene,
OnPopulateSceneCallback pOnPopulateSceneCallback)
throws IOException {
pOnPopulateSceneCallback.onPopulateSceneFinished();
}
@Override
public synchronized void onGameCreated() {
super.onGameCreated();
}
@Override
protected synchronized void onResume() {
getEngine().getSoundManager().setMasterVolume(1);
getEngine().getMusicManager().setMasterVolume(1);
super.onResume();
}
@Override
protected void onPause() {
getEngine().getSoundManager().setMasterVolume(0);
getEngine().getMusicManager().setMasterVolume(0);
super.onPause();
}
@Override
protected Scene onAssetsLoaded() {
Scene scene = new Scene();
// add wood background image
scene.setBackground(new SpriteBackground(new Sprite(
Prefs.cameraWidth/2, Prefs.cameraHeight/2,
mBGTextureRegion, getVertexBufferObjectManager())));
// game name
Text nameText1 = new Text(Prefs.cameraWidth/2,
Prefs.cameraHeight - 150, headFont, "Beetle",
getVertexBufferObjectManager());
Text nameText2 = new Text(Prefs.cameraWidth/2,
Prefs.cameraHeight - 250, headFont, "Smasher",
getVertexBufferObjectManager());
scene.attachChild(nameText1);
scene.attachChild(nameText2);
// add menu window
Sprite window = new Sprite(Prefs.cameraWidth/2,
Prefs.cameraHeight/2, mWindowTextureRegion,
getVertexBufferObjectManager());
window.setZIndex(5);
window.setAlpha(0.7f);
scene.attachChild(window);
// add resume button
TextButton playButton = new TextButton(scene, Prefs.cameraWidth/2,
Prefs.cameraHeight/2 + 100, mButtonTextureRegion, menuFont,
"Play", getVertexBufferObjectManager()) {
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
float pTouchAreaLocalX, float pTouchAreaLocalY) {
if (pSceneTouchEvent.isActionUp()) {
Intent intent = new Intent(getApplicationContext(),
GameActivity.class);
startActivity(intent);
finish();
} else if (pSceneTouchEvent.isActionDown()) {
if (Prefs.soundEnabled)
clickSound.play();
}
super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX,
pTouchAreaLocalY);
return true;
}
};
playButton.setZIndex(6);
scene.registerTouchArea(playButton);
scene.attachChild(playButton);
TextButton exitButton = new TextButton(scene, Prefs.cameraWidth/2,
Prefs.cameraHeight/2 - 100, mButtonTextureRegion, menuFont,
"Exit", getVertexBufferObjectManager()) {
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
float pTouchAreaLocalX, float pTouchAreaLocalY) {
if (pSceneTouchEvent.isActionUp()) {
finish();
} else if (pSceneTouchEvent.isActionDown()) {
if (Prefs.soundEnabled)
clickSound.play();
}
super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX,
pTouchAreaLocalY);
return true;
}
};
exitButton.setZIndex(6);
scene.registerTouchArea(exitButton);
scene.attachChild(exitButton);
// add sound button with cross
cross = new Sprite(0, 0, mCrossTextureRegion,
getVertexBufferObjectManager());
cross.setVisible(false);
cross.setZIndex(6);
Sprite soundButton = new Sprite(Prefs.cameraWidth/2 + 250, 200,
mSoundButtonTextureRegion, getVertexBufferObjectManager()) {
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
float pTouchAreaLocalX, float pTouchAreaLocalY) {
if (pSceneTouchEvent.isActionDown()) {
if (Prefs.soundEnabled) {
Prefs.soundEnabled = false;
Editor editor = mSettings.edit();
editor.putBoolean("sound", false);
editor.apply();
music.pause();
cross.setVisible(true);
} else {
Prefs.soundEnabled = true;
Editor editor = mSettings.edit();
editor.putBoolean("sound", true);
editor.apply();
music.resume();
cross.setVisible(false);
}
if (Prefs.soundEnabled)
clickSound.play();
setScale(0.7f);
} else if (pSceneTouchEvent.isActionUp()) {
setScale(0.8f);
}
return true;
}
};
soundButton.setScale(0.8f);
soundButton.setZIndex(5);
scene.attachChild(soundButton);
scene.registerTouchArea(soundButton);
cross.setPosition(soundButton);
cross.setScale(0.5f);
cross.setAlpha(0.7f);
scene.attachChild(cross);
if (useGooglePlayServices) {
Sprite recordsButton = new Sprite(Prefs.cameraWidth/2 - 250, 200,
mLeaderboardTextureRegion, getVertexBufferObjectManager()) {
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
float pTouchAreaLocalX, float pTouchAreaLocalY) {
if (pSceneTouchEvent.isActionDown()) {
if (!mGameHelper.isSignedIn())
mGameHelper.beginUserInitiatedSignIn();
else
ShowLeaderboard();
if (Prefs.soundEnabled)
clickSound.play();
setScale(0.7f);
} else if (pSceneTouchEvent.isActionUp()) {
setScale(0.8f);
}
return true;
}
};
recordsButton.setScale(0.8f);
recordsButton.setZIndex(5);
scene.attachChild(recordsButton);
scene.registerTouchArea(recordsButton);
}
// read prefs
mSettings = getSharedPreferences("Settings", 0);
Prefs.soundEnabled = mSettings.getBoolean("sound", true);
if (Prefs.soundEnabled) {
music.play();
} else {
cross.setVisible(true);
}
int highscore = mSettings.getInt("score", 0);
if (highscore > 0) {
Text highscore_text = new Text(Prefs.cameraWidth/2, 210,
menuFont, "Highscore", getVertexBufferObjectManager());
highscore_text.setScale(0.5f);
scene.attachChild(highscore_text);
Text highscore_num = new Text(Prefs.cameraWidth/2, 155, menuFont,
Integer.toString(highscore), 100,
getVertexBufferObjectManager());
highscore_num.setScale(0.5f);
scene.attachChild(highscore_num);
}
scene.setTouchAreaBindingOnActionDownEnabled(true);
scene.setTouchAreaBindingOnActionMoveEnabled(true);
scene.sortChildren();
return scene;
}
@Override
protected void assetsToLoad() {
// creating game atlases
mBGAtlas = new BitmapTextureAtlas(getTextureManager(), 1024, 2048,
TextureOptions.BILINEAR);
mWindowAtlas = new BitmapTextureAtlas(getTextureManager(), 1024, 512,
TextureOptions.BILINEAR);
mWindowAtlas.addEmptyTextureAtlasSource(0, 0, 1024, 512);
mButtonAtlas = new BitmapTextureAtlas(getTextureManager(), 512, 256,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mButtonAtlas.addEmptyTextureAtlasSource(0, 0, 512, 256);
mSoundButtonAtlas = new BitmapTextureAtlas(getTextureManager(), 256,
256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mSoundButtonAtlas.addEmptyTextureAtlasSource(0, 0, 256, 256);
mCrossAtlas = new BitmapTextureAtlas(getTextureManager(), 256, 256,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mCrossAtlas.addEmptyTextureAtlasSource(0, 0, 256, 256);
mLeaderboardAtlas = new BitmapTextureAtlas(getTextureManager(), 256,
256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mLeaderboardAtlas.addEmptyTextureAtlasSource(0, 0, 256, 256);
// creating texture regions
BitmapTextureAtlasTextureRegionFactory
.setAssetBasePath("gfx/interface/");
mBGTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(mBGAtlas, getAssets(), "bg.png", 0, 0);
mWindowTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(mWindowAtlas, getAssets(), "window.png", 0, 0);
mButtonTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(mButtonAtlas, getAssets(), "button.png", 0, 0);
mSoundButtonTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(mSoundButtonAtlas, getAssets(),
"sound_button.png", 0, 0);
mCrossTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(mCrossAtlas, getAssets(), "cross.png", 0, 0);
mLeaderboardTextureRegion = BitmapTextureAtlasTextureRegionFactory
.createFromAsset(mLeaderboardAtlas, getAssets(),
"leaderboard.png", 0, 0);
// loading atlases
mBGAtlas.load();
mWindowAtlas.load();
mButtonAtlas.load();
mSoundButtonAtlas.load();
mCrossAtlas.load();
mLeaderboardAtlas.load();
// loading fonts
FontFactory.setAssetBasePath("fonts/");
BitmapTextureAtlas fontAtlas = new BitmapTextureAtlas(
getTextureManager(), 512, 512,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
fontAtlas.addEmptyTextureAtlasSource(0, 0, 512, 512);
final ITexture fontTexture = fontAtlas;
menuFont = FontFactory.createFromAsset(getFontManager(), fontTexture,
getAssets(), "font.ttf", 80, true, Color.BLACK);
menuFont.load();
BitmapTextureAtlas fontAtlas2 = new BitmapTextureAtlas(
getTextureManager(), 512, 512,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
fontAtlas2.addEmptyTextureAtlasSource(0, 0, 512, 512);
final ITexture fontTexture2 = fontAtlas2;
headFont = FontFactory
.createFromAsset(getFontManager(), fontTexture2, getAssets(),
"headfont.ttf", 100, true, Color.rgb(100, 167, 60));
headFont.load();
// loading sounds
SoundFactory.setAssetBasePath("sfx/");
try {
clickSound = SoundFactory.createSoundFromAsset(getEngine()
.getSoundManager(), this, "click.mp3");
} catch (IOException e) {
e.printStackTrace();
}
// loading music
MusicFactory.setAssetBasePath("mfx/");
try {
music = MusicFactory.createMusicFromAsset(getEngine()
.getMusicManager(), this, "menu.mp3");
music.setVolume(music.getVolume()/1.7f);
music.setLooping(true);
} catch (IOException e) {
e.printStackTrace();
}
}
}
java.lang.IllegalArgumentException:找不到EGLConfig! – Unii