GoogleApiClient .connect()会触发致命错误

时间:2016-05-05 19:31:22

标签: android google-play-services fatal-error google-api-client

几个小时以来,我通过GoogleApiClient阅读了有关致命错误的消息,但没有任何一个灵魂导致......

我知道当mGoogleApiClient.connect()被触发时会发生这种情况,因为我设置了一个日志(“Hier”),并在此日志之后调用此方法。

那么请有人给我一个暗示吗?我必须使用另一个套餐吗? (已安装:SDK Manager-> GooglePlayService,Android Studio->导入模块 - > BaseGameUtilitis)

结束时的Logcat + ERROR(活动从另一个活动开始):

05-05 21:11:16.066 9299-9299/pright.superuser.tabtheright W/System: ClassLoader referenced unknown path: /data/app/pright.superuser.tabtheright-1/lib/arm64
05-05 21:11:16.338 9299-9299/pright.superuser.tabtheright W/System: ClassLoader referenced unknown path: /data/app/pright.superuser.tabtheright-1/lib/arm64
05-05 21:11:16.388 9299-9299/pright.superuser.tabtheright I/GMPM: App measurement is starting up, version: 8487
05-05 21:11:16.388 9299-9299/pright.superuser.tabtheright I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
05-05 21:11:16.837 9299-9299/pright.superuser.tabtheright D/ChimeraCfgMgr: Reading stored module config
05-05 21:11:16.888 9299-9299/pright.superuser.tabtheright D/ChimeraFileApk: Primary ABI of requesting process is arm64-v8a
05-05 21:11:16.889 9299-9299/pright.superuser.tabtheright D/ChimeraFileApk: Classloading successful. Optimized code found.
05-05 21:11:16.901 9299-9299/pright.superuser.tabtheright D/DynamitePackage: Instantiated singleton DynamitePackage.
05-05 21:11:16.901 9299-9299/pright.superuser.tabtheright D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
05-05 21:11:16.984 9299-9299/pright.superuser.tabtheright W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
05-05 21:11:16.989 9299-9299/pright.superuser.tabtheright W/AudioCapabilities: Unsupported mime audio/alac
05-05 21:11:16.990 9299-9299/pright.superuser.tabtheright W/AudioCapabilities: Unsupported mime audio/dsd
05-05 21:11:16.994 9299-9299/pright.superuser.tabtheright W/VideoCapabilities: Unsupported mime video/divx
05-05 21:11:16.995 9299-9299/pright.superuser.tabtheright W/VideoCapabilities: Unsupported mime video/divx311
05-05 21:11:16.996 9299-9299/pright.superuser.tabtheright W/VideoCapabilities: Unsupported mime video/divx4
05-05 21:11:17.000 9299-9299/pright.superuser.tabtheright W/VideoCapabilities: Unsupported mime video/mp4v-esdp
05-05 21:11:17.008 9299-9299/pright.superuser.tabtheright I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
05-05 21:11:17.024 9299-9344/pright.superuser.tabtheright I/OMXClient: Using client-side OMX mux.
05-05 21:11:17.221 9299-9299/pright.superuser.tabtheright I/WebViewFactory: Loading com.google.android.webview version 50.0.2661.86 (code 266108650)
05-05 21:11:17.355 9299-9299/pright.superuser.tabtheright I/cr_LibraryLoader: Time to load native libraries: 13 ms (timestamps 8907-8920)
05-05 21:11:17.359 9299-9299/pright.superuser.tabtheright I/cr_LibraryLoader: Expected native library version number "50.0.2661.86", actual native library version number "50.0.2661.86"
05-05 21:11:17.393 9299-9299/pright.superuser.tabtheright V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {41a4fbf}
05-05 21:11:17.393 9299-9299/pright.superuser.tabtheright I/cr_LibraryLoader: Expected native library version number "50.0.2661.86", actual native library version number "50.0.2661.86"
05-05 21:11:17.438 9299-9299/pright.superuser.tabtheright I/chromium: [INFO:library_loader_hooks.cc(143)] Chromium logging enabled: level = 0, default verbosity = 0
05-05 21:11:17.492 9299-9299/pright.superuser.tabtheright I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
05-05 21:11:17.651 9299-9299/pright.superuser.tabtheright I/Adreno: QUALCOMM build                   : 1c8141a, I8f3b63409d
                                                                    Build Date                       : 01/12/16
                                                                    OpenGL ES Shader Compiler Version: XE031.06.00.02
                                                                    Local Branch                     : 
                                                                    Remote Branch                    : refs/tags/AU_LINUX_ANDROID_LA.BF64.1.2.2_RB4.06.00.00.180.011
                                                                    Remote Branch                    : NONE
                                                                    Reconstruct Branch               : NOTHING
05-05 21:11:17.809 9299-9393/pright.superuser.tabtheright W/cr_media: Requires BLUETOOTH permission
05-05 21:11:17.883 9299-9299/pright.superuser.tabtheright I/Ads: Starting ad request.
05-05 21:11:17.912 9299-9299/pright.superuser.tabtheright I/MyApp: Portait
05-05 21:11:17.963 9299-9403/pright.superuser.tabtheright D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-05 21:11:18.000 9299-9405/pright.superuser.tabtheright D/ConnectivityManager.CallbackHandler: CM callback handler got msg 524290
05-05 21:11:18.036 9299-9403/pright.superuser.tabtheright I/OpenGLRenderer: Initialized EGL, version 1.4
05-05 21:11:18.105 9299-9308/pright.superuser.tabtheright D/MediaOutputController: detach(0x55810a87e0)
05-05 21:11:18.105 9299-9308/pright.superuser.tabtheright W/MediaOutputPolicy: No callback found for owner: 0x55810a87e0
05-05 21:11:18.250 9299-9403/pright.superuser.tabtheright V/RenderScript: 0x558133bc00 Launching thread(s), CPUs 8
05-05 21:11:18.292 9299-9299/pright.superuser.tabtheright I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@c42373e time:669119858
05-05 21:11:18.663 9299-9405/pright.superuser.tabtheright D/ConnectivityManager.CallbackHandler: CM callback handler got msg 524290
05-05 21:11:18.681 9299-9299/pright.superuser.tabtheright D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
05-05 21:11:18.695 9299-9299/pright.superuser.tabtheright W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
05-05 21:11:18.695 9299-9299/pright.superuser.tabtheright D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
05-05 21:11:18.748 9299-9299/pright.superuser.tabtheright I/cr_Ime: ImeThread is not enabled.
05-05 21:11:18.898 9299-9444/pright.superuser.tabtheright E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
05-05 21:11:18.940 9299-9299/pright.superuser.tabtheright W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 9299
05-05 21:11:18.940 9299-9299/pright.superuser.tabtheright D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
05-05 21:11:19.625 9299-9299/pright.superuser.tabtheright I/Ads: Scheduling ad refresh 60000 milliseconds from now.
05-05 21:11:19.645 9299-9299/pright.superuser.tabtheright D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
05-05 21:11:19.647 9299-9299/pright.superuser.tabtheright W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
05-05 21:11:19.652 9299-9299/pright.superuser.tabtheright D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
05-05 21:11:19.661 9299-9299/pright.superuser.tabtheright I/cr_Ime: ImeThread is not enabled.
05-05 21:11:19.668 9299-9299/pright.superuser.tabtheright I/Ads: Ad finished loading.
05-05 21:11:19.957 9299-9299/pright.superuser.tabtheright W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 9299
05-05 21:11:19.957 9299-9299/pright.superuser.tabtheright D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
05-05 21:11:20.017 9299-9299/pright.superuser.tabtheright I/chromium: [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
05-05 21:11:20.020 9299-9299/pright.superuser.tabtheright I/chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
05-05 21:11:20.199 9299-9299/pright.superuser.tabtheright I/chromium: [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
05-05 21:11:23.613 9299-9299/pright.superuser.tabtheright I/Timeline: Timeline: Activity_launch_request id:pright.superuser.tabtheright time:669125178
05-05 21:11:23.895 9299-9299/pright.superuser.tabtheright W/PopupManager: You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen environments
05-05 21:11:23.903 9299-9299/pright.superuser.tabtheright I/MyApp: Hier
05-05 21:11:24.096 9299-9299/pright.superuser.tabtheright I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@6d61662 time:669125662
05-05 21:11:24.300 9299-9299/pright.superuser.tabtheright D/AndroidRuntime: Shutting down VM
05-05 21:11:24.300 9299-9299/pright.superuser.tabtheright E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: pright.superuser.tabtheright, PID: 9299
                                                                            java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
                                                                                at com.google.android.gms.common.internal.zzj$zza.zzc(Unknown Source)
                                                                                at com.google.android.gms.common.internal.zzj$zza.zzw(Unknown Source)
                                                                                at com.google.android.gms.common.internal.zzj$zzc.zzqN(Unknown Source)
                                                                                at com.google.android.gms.common.internal.zzj$zzb.handleMessage(Unknown Source)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:224)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5514)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

活动

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;

import com.example.superuser.tabtheright.R;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Drive;
import com.google.android.gms.games.Games;
import com.google.android.gms.plus.Plus;
import com.google.example.games.basegameutils.BaseGameActivity;
import com.google.android.gms.*;

public class LeaderbordActivity extends BaseGameActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {

    private GoogleApiClient mGoogleApiClient;
    int numGuesses;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_leaderbord);
        SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE);
        numGuesses = pref.getInt("oldcounter", 0);

        mGoogleApiClient = new GoogleApiClient.Builder(getApplicationContext())
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addScope(Games.SCOPE_GAMES)
                .addApi(Games.API).addScope(Games.SCOPE_GAMES)
                .setViewForPopups(findViewById(android.R.id.content))
                // add other APIs and scopes here as needed
                .build();
        Log.i("MyApp","Hier");

    }





    @Override
    public void onConnected(@Nullable Bundle bundle) {
        beginUserInitiatedSignIn();
        Games.Leaderboards.submitScore(mGoogleApiClient,
                getString(R.string.number_leaderboard),
                numGuesses);
        startActivityForResult(Games.Leaderboards.getLeaderboardIntent(
                mGoogleApiClient, getString(R.string.number_leaderboard)),
                2);

    }

    @Override
    protected void onStart() {
        super.onStart();
        mGoogleApiClient.connect();
    }

    @Override
    public void onConnectionSuspended(int i) {

    }

    @Override
    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {

    }

    @Override
    public void onSignInFailed() {

    }

    @Override
    public void onSignInSucceeded() {

    }
}

清单

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.superuser.tabtheright">


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:name="tabtheright.PRight.superuser.tabtheright.HomeActivity"
            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="tabtheright.PRight.superuser.tabtheright.PlayActivity"
            android:label="@string/app_name"
            android:parentActivityName="tabtheright.PRight.superuser.tabtheright.HomeActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="tabtheright.PRight.superuser.tabtheright.HomeActivity" />
        </activity>

        <activity
            android:name="tabtheright.PRight.superuser.tabtheright.LeaderbordActivity"
            android:label="@string/app_name"
            android:parentActivityName="tabtheright.PRight.superuser.tabtheright.HomeActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="tabtheright.PRight.superuser.tabtheright.HomeActivity" />
            <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"/>
        </activity>

    </application>

</manifest>

1 个答案:

答案 0 :(得分:0)

我讨厌我! 几个小时后,我最后得到这个:Initializing Games Client in Android

并有评论: facepalm - 我在AndroidManifest.xml中有它,但在我的标签上没有。谢谢

是的,如果你在我的代码中看到,我做了同样的事情......

<强>解

不要将元标记放在活动中,您必须在活动之外的应用程序标记中执行此操作。