Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libgdx - IllegalStateException at unknown location

I am using android studio 1.3, and libgdx 1.6.2 to create a game. I want to incorporate google play services to my game and I have completed everything in one step, because I did it before without problem. However, this time it gave me an exception:

java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
        at com.google.android.gms.common.internal.zzi$zza.zzc(Unknown Source)
        at com.google.android.gms.common.internal.zzi$zza.zzr(Unknown Source)
        at com.google.android.gms.common.internal.zzi$zzc.zznQ(Unknown Source)
        at com.google.android.gms.common.internal.zzi$zzb.handleMessage(Unknown Source)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5254)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

So here is what I changed other than adding baseGameUtils (which was sucessfully added).

EDIT: The Full Android Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bearfishapps.cells.android"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <meta-data android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />
    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/GdxTheme" >
        <activity
            android:name="com.example.app.android.AndroidLauncher"
            android:label="@string/app_name" 
            android:screenOrientation="portrait"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="com.purplebrain.adbuddiz.sdk.AdBuddizActivity"
            android:theme="@android:style/Theme.Translucent" />
    </application>

</manifest>

And here is my android main activity.

public class AndroidLauncher extends AndroidApplication  implements GameHelper.GameHelperListener{

    private GameHelper gameHelper;
    @Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (gameHelper == null) {
            gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
        }
        gameHelper.setup(this);

        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        initialize(new Cells(new ActionResolver() {
            @Override
            public boolean getSignedInGPGS() {
                return gameHelper.isSignedIn();
            }

            @Override
            public void loginGPGS() {
                try {
                    runOnUiThread(new Runnable() {
                        public void run() {
                            gameHelper.beginUserInitiatedSignIn();
                        }
                    });
                } catch (final Exception ex) {

                }
            }

            @Override
            public void submitScoreGPGS(int score) {
                Games.Leaderboards.submitScore(gameHelper.getApiClient(), "CgkI6ZHYr9IEEAIQBg", score);
            }

            @Override
            public void getLeaderboardGPGS() {
                if (gameHelper.isSignedIn()) {
                    startActivityForResult(Games.Leaderboards.getLeaderboardIntent(gameHelper.getApiClient(), "CgkI6ZHYr9IEEAIQBg "), 100);
                }
                else if (!gameHelper.isConnecting()) {
                    loginGPGS();
                }

            }

            @Override
            public void unlockAchievementGPGS(String achievementId) {
                Games.Achievements.unlock(gameHelper.getApiClient(), achievementId);
            }

            @Override
            public void getAchievementsGPGS() {
                if (gameHelper.isSignedIn()) {
                    startActivityForResult(Games.Achievements.getAchievementsIntent(gameHelper.getApiClient()), 101);
                }
                else if (!gameHelper.isConnecting()) {
                    loginGPGS();
                }

            }


        }), config);
    }

    @Override
    public void onStart(){
        super.onStart();
        gameHelper.onStart(this);
    }
    @Override
    public void onStop(){
        super.onStop();
        gameHelper.onStop();
    }
    @Override
    public void onActivityResult(int request, int response, Intent data) {
        super.onActivityResult(request, response, data);
        gameHelper.onActivityResult(request, response, data);
    }

    @Override
    public void onSignInFailed() {

    }

    @Override
    public void onSignInSucceeded() {

    }
}

I can't tell whats wrong here. Thanks in advance.

like image 464
Fish Avatar asked Aug 04 '15 19:08

Fish


1 Answers

You need to use <meta-data> inside your <application> tag in the AndroidManifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bearfishapps.cells.android"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/GdxTheme" >
        <activity
            android:name="com.example.app.android.AndroidLauncher"
            android:label="@string/app_name" 
            android:screenOrientation="portrait"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="com.purplebrain.adbuddiz.sdk.AdBuddizActivity"
            android:theme="@android:style/Theme.Translucent" />

    <meta-data android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />
    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    </application>

</manifest>

Clear your data and uninstall updates on Google Play Services.

Then, reinstall it.

like image 144
Machado Avatar answered Sep 23 '22 03:09

Machado