我目前遇到代码
的问题 googleApiClient = new GoogleApiClient.Builder(activity, this,this)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.build();
工作正常,但
googleApiClient = new GoogleApiClient.Builder(activity, this,this)
.addApi(Drive.API)
.build();
不想连接,只返回
ConnectionResult {statusCode = INTERNAL_ERROR,resolution = null,message = null}
似乎有一个很多的问题,但大多数问题只是针对特定情况。到目前为止,似乎我的场景将是独特的,因此在该网站上偏离主题。我的产品名称在开发人员控制台中设置,包匹配且签名正确。启用了所需的api,并且在任何主题中都没有给出任何建议似乎有所帮助。似乎只有时间,试验和错误才能解决我的问题。
现在问题出现了,如何调试这个问题?如果没有共同的解决方案,这似乎是一个普遍的问题,那么可以采取哪些步骤来找出解决问题的方法呢?
编辑:
为了更具体地了解这种情况,似乎问题出在com.google.android.gms
服务的某个地方。那个人每次都会崩溃。下面是以下代码的logcat:
new AsyncTask<Void,Void,Void>() {
@Override
protected Void doInBackground(Void... voids) {
Log.d("Snapshot", "3");
googleApiClient.blockingConnect();
Log.d("Snapshot", "4");
return null;
}
}.execute();
这个logcat中的错误是一致的,每次都会发生,当然有不同的时间戳和进程ID,其中一些可能与问题无关,但对我来说,几乎不可能过滤掉它。
07-03 16:05:52.025 23176-24251/nl.dvandenberg.energymonitor D/Snapshot: 3
--------- beginning of system
07-03 16:05:52.026 891-6829/? W/AppOps: Bad call: specified package com.google.android.gms under uid 10252 but it is really 10010
07-03 16:05:52.043 335-1227/? D/AudioPolicyManager: startOutput()--
07-03 16:05:52.043 335-1227/? I/AudioFlinger: vl# new track,stream:1,masterVolume:1.000000,typeVolume:0.501188,vlf:0.501160,vrf:0.501160
07-03 16:05:52.046 335-987/? D/audio_hw_primary: start_output_stream: enter: stream(0xb59a3640)usecase(1: low-latency-playback) devices(0x2)
07-03 16:05:52.046 335-987/? D/audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: )
07-03 16:05:52.046 335-987/? D/hardware_info: hw_info_append_hw_type : device_name = speaker
07-03 16:05:52.046 335-987/? D/ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 15, path = 0
07-03 16:05:52.051 335-987/? E/msm8974_platform: wdd add mixer_path low-latency-playback i2s prop_value 15055
07-03 16:05:52.052 335-987/? D/audio_hw_primary: select_devices: done
07-03 16:05:52.175 891-1864/? D/ConnectivityService: listenForNetwork for NetworkRequest [ id=3904, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
07-03 16:05:52.175 891-1245/? D/ConnectivityService: handleRegisterNetworkRequest checking NetworkAgentInfo [WIFI () - 382]
07-03 16:05:52.175 891-1245/? D/ConnectivityService: apparently satisfied. currentScore=60
07-03 16:05:52.176 891-1245/? D/ConnectivityService: sending notification AVAILABLE for NetworkRequest [ id=3904, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
07-03 16:05:52.177 26026-26135/? D/ConnectivityManager.CallbackHandler: CM callback handler got msg 524290
07-03 16:05:52.311 26026-26136/? W/DriveInitializer: Background init thread started
07-03 16:05:52.331 26141-26141/? D/StatusBar.MSimNetworkController: refreshViews phoneId =0mMSimDataConnected =false
07-03 16:05:52.331 26141-26141/? D/StatusBar.MSimNetworkController: refreshViews mMSimDataActivity =0
07-03 16:05:52.334 26141-26141/? D/StatusBar.MSimNetworkController: refreshViews: Data not connected!! Set no data type icon / Roaming for phoneId: 0
07-03 16:05:52.335 335-985/? D/AudioPolicyManager: stopOutput() output 4, stream 1, session 785
07-03 16:05:52.335 335-985/? D/AudioPolicyManager: stopOutput()--
07-03 16:05:52.360 26026-26137/? I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:1 and remote module com.google.android.gms.googlecertificates:1
07-03 16:05:52.360 26026-26137/? I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 1
07-03 16:05:52.391 26026-26137/? D/ChimeraFileApk: Primary ABI of requesting process is armeabi-v7a
07-03 16:05:52.393 26026-26137/? D/ChimeraFileApk: Classloading successful. Optimized code found.
07-03 16:05:52.393 26026-26137/? I/asset: Success to oxygen resources /system/framework/oxygen-framework-res.apk
07-03 16:05:52.398 26026-26137/? D/GoogleCertificates: com.google.android.gms.googlecertificates module is loaded
07-03 16:05:52.455 26026-26139/? I/GCore-Chimera-Crash: Cg0KB3ZJbmZyYTQQor84Gl8KHWNvbS5nb29nbGUuYW5kcm9pZC
5wbGF5LmdhbWVzEhQzLjcuMjMgKDI4Njc2MzctMDM4KRjWq-AR
IiMKHGNvbS5nb29nbGUuYW5kcm9pZC5nbXMuZ2FtZXMQsKvgEQ
==
GCore-Chimera-Crash
--------- beginning of crash
07-03 16:05:52.458 26026-26139/? E/AndroidRuntime: FATAL EXCEPTION: highpool[0]
Process: com.google.android.gms, PID: 26026
java.lang.NullPointerException: Attempt to read from field 'kau jwg.a' on a null object reference
at jzf.a(:com.google.android.gms:336)
at kip.a(:com.google.android.gms:11149)
at kip.b(:com.google.android.gms:415)
at kiq.run(:com.google.android.gms:1054)
at loq.run(:com.google.android.gms:53)
at itt.run(:com.google.android.gms:453)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at iyg.run(:com.google.android.gms:17)
at java.lang.Thread.run(Thread.java:818)
07-03 16:05:52.460 26026-26139/? E/AndroidRuntime: Error reporting crash
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.<init>(Handler.java:200)
at android.os.Handler.<init>(Handler.java:114)
at android.content.AsyncQueryHandler.<init>(AsyncQueryHandler.java:125)
at net.oneplus.odm.insight.tracker.AbstractTracker$TrackerAsyncQueryHandler.<init>(AbstractTracker.java:110)
at net.oneplus.odm.insight.tracker.AbstractTracker.<init>(AbstractTracker.java:60)
at net.oneplus.odm.insight.tracker.AppTracker.<init>(AppTracker.java:24)
at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:99)
at icd.uncaughtException(:com.google.android.gms:54)
at ibx.uncaughtException(:com.google.android.gms:62)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
07-03 16:05:52.463 26026-26139/? I/Process: Sending signal. PID: 26026 SIG: 9
07-03 16:05:52.489 891-3957/? I/ActivityManager: Process com.google.android.gms (pid 26026) has died
07-03 16:05:52.489 891-5403/? E/WifiService: Multicaster binderDied
07-03 16:05:52.489 891-1250/? D/ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ id=3904, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ], android.os.BinderProxy@d4be6da)
07-03 16:05:52.490 891-1245/? D/ConnectivityService: releasing NetworkRequest NetworkRequest [ id=3904, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
07-03 16:05:52.490 891-1245/? D/ConnectivityService: sending notification RELEASED for NetworkRequest [ id=3904, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
07-03 16:05:52.491 891-1245/? E/ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [ id=3904, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN] ]
07-03 16:05:52.492 19485-19485/? V/GAV3: Thread[main,5,main]: service disconnected: ComponentInfo{com.google.android.gms/com.google.android.gms.analytics.service.AnalyticsService}
07-03 16:05:52.492 19485-19485/? V/GAV3: Thread[main,5,main]: Unexpected disconnect.
07-03 16:05:52.493 19485-19485/? V/GAV3: Thread[main,5,main]: service disconnected: ComponentInfo{com.google.android.gms/com.google.android.gms.analytics.service.AnalyticsService}
07-03 16:05:52.493 19485-19485/? V/GAV3: Thread[main,5,main]: Unexpected disconnect.
07-03 16:05:52.496 891-3957/? W/ActivityManager: Scheduling restart of crashed service com.google.android.gms/com.google.android.location.places.service.GeoDataService in 1000ms
07-03 16:05:52.496 891-3957/? W/ActivityManager: Scheduling restart of crashed service com.google.android.gms/.drive.api.ApiService in 11000ms
07-03 16:05:52.496 891-3957/? W/ActivityManager: Scheduling restart of crashed service com.google.android.gms/.analytics.service.AnalyticsService in 21000ms
07-03 16:05:52.497 891-3957/? W/ActivityManager: Scheduling restart of crashed service com.google.android.gms/.signin.service.SignInAsyncService in 31000ms
07-03 16:05:52.497 891-3957/? W/ActivityManager: Scheduling restart of crashed service com.google.android.gms/.measurement.service.MeasurementBrokerService in 31000ms
07-03 16:05:52.497 891-3957/? W/ActivityManager: Scheduling restart of crashed service com.google.android.gms/.signin.service.SignInBrokerService in 41000ms
07-03 16:05:52.497 891-3957/? W/ActivityManager: Scheduling restart of crashed service com.google.android.gms/.cast.media.CastMediaRouteProviderService in 51000ms
07-03 16:05:52.508 23176-23176/nl.dvandenberg.energymonitor D/Snapshot: Connection failed: ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null, message=null}
07-03 16:05:52.513 23176-23176/nl.dvandenberg.energymonitor I/AppCompatDelegate: The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's
07-03 16:05:52.529 891-5403/? V/WindowManager: not Base app: Adding window Window{3ad0e9e8 u0 nl.dvandenberg.energymonitor/nl.dvandenberg.energymonitor.SplashActivity} at 23 of 29
07-03 16:05:52.540 23176-24251/nl.dvandenberg.energymonitor D/Snapshot: 4
编辑2:
我设法通过向构建器添加.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
来解决我自己的问题。我不知道为什么这个有效或者需要,但只要它有效,我就会接受它。
我不会将此作为答案发布,因为在这个问题中,我想集中讨论如何找到问题的根源,而不是列出可能的解决方案。