不幸的是<app-name>已经停止 - eclipse设备emulater错误</app-name>

时间:2014-04-08 22:34:57

标签: java android eclipse

当我尝试使用模拟器运行我的应用程序时,我收到标题建议的错误。控制台说一切顺利,logcat什么也没显示。以下是我的Android Manifest。 signIn是在启动时应该打开的类。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.LoneLightning.app"
android:versionCode="1"
android:versionName="1.0" >

<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" >
<activity android:name="com.LoneLightning.app.SignIn"
          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.LoneLightning.app.MainMenu"
    android:label="MainMenu" >
</activity>
<activity
    android:name="com.LoneLightning.app.LevelOne"
    android:label="LevelOne" >
</activity>
<activity
    android:name="com.LoneLightning.orangedot.Leaderboard"
    android:label="Leaderboard" >
</activity>
</application>

SignIn.java让你很好奇

    import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import com.google.example.games.basegameutils.BaseGameActivity;

public class SignIn extends BaseGameActivity
    implements View.OnClickListener{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sign_in_layout);
        findViewById(R.id.sign_in_button).setOnClickListener((OnClickListener) this);
        findViewById(R.id.sign_out_button).setOnClickListener((OnClickListener) this);        
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.sign_in_button) {
            // start the asynchronous sign in flow
            beginUserInitiatedSignIn();
        }
        else if (view.getId() == R.id.sign_out_button) {
            // sign out.
            signOut();

            // show sign-in button, hide the sign-out button
            findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
            findViewById(R.id.sign_out_button).setVisibility(View.GONE);
        }
    }

    @Override
    public void onSignInFailed() {
        findViewById(R.id.textView1).setVisibility(View.VISIBLE);

    }

    public void onSignInSucceeded() {
        // show sign-out button, hide the sign-in button
        findViewById(R.id.sign_in_button).setVisibility(View.GONE);
        findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE);
        Intent intent = new Intent(this, MainMenu.class);
        startActivity(intent);

        // (your code here: update UI, enable functionality that depends on sign in, etc)
    }


}

1 个答案:

答案 0 :(得分:0)

嗯,根据the docs,您需要:

  

导入gms.common.api包和BaseGameActivity类。

因此,如果您已经安装了所有必需的东西,则只需添加以下行:

import gms.common.api.*;

如果没有,请检查this link以正确设置。