gpt4 book ai didi

android - 在 android 上使用 google drive api_key

转载 作者:太空狗 更新时间:2023-10-29 14:44:20 32 4
gpt4 key购买 nike

我听了很多教程,目前我有:

  • 在 Google Developer Console 上创建了一个新项目
  • 创建了一个新的 api key ,将其限制为 android 应用程序,添加了我的包名称(AndroidManifest.xml 中 list 标签的 package="XXXX.YYYY"字段),添加了我的 SHA1(使用此命令 keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v )
  • 在我的 AndroidManifest.xml 中添加了 INTERNET、ACCESS_NETWORK_STATE 和 GET_ACCOUNTS 权限
  • 已添加 <meta-data android:name="com.google.android.apps.drive.APP_ID" android:value="id=My_Key_copied_from_google_devel_console" /> AndroidManifest.xml 中的应用程序标签内
  • 在gradle中添加了这个dep:compile 'com.google.android.gms:play-services-drive:9.0.0'
  • 创建了一个新 Activity 并从 google 的快速入门示例中复制粘贴了 MainActivity

现在当我点击我的帐户进行身份验证时出现此错误:

02-23 20:47:20.105 1931-2504/com.google.android.gms.persistent W/GLSUser: [AppCertManager] IOException while requesting key: 
java.io.IOException: Invalid device key response.
at enr.a(:com.google.android.gms:282)
at enr.a(:com.google.android.gms:4237)
at enq.a(:com.google.android.gms:46)
at enk.a(:com.google.android.gms:53)
at enj.a(:com.google.android.gms:111)
at com.google.android.gms.auth.account.be.legacy.AuthCronChimeraService.b(:com.google.android.gms:4052)
at dxg.call(:com.google.android.gms:2043)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at kzi.run(:com.google.android.gms:450)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at ldm.run(:com.google.android.gms:17)
at java.lang.Thread.run(Thread.java:818)

我正在使用带有 google api 的 android 模拟器 5.0 x86_64 进行测试。

我哪里做错了?

编辑:正如 Bertrand Martel 指出的那样,我必须签署我的 apk,但仍然没有运气。

还有一个完整的日志:

02-23 22:19:15.605 1493-1519/system_process I/ActivityManager: Displayed rmbq.patrol_one_v2.unbrand/rmbq.patrol_one_v2.WelcomeActivity: +84ms
02-23 22:19:15.623 3083-3100/rmbq.patrol_one_v2.unbrand D/OpenGLRenderer: endAllStagingAnimators on 0x7fc2591be400 (RippleDrawable) with handle 0x7fc25a73e660
02-23 22:19:16.997 1493-1559/system_process W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client
02-23 22:19:16.997 1493-2523/system_process I/ActivityManager: START u0 {cmp=rmbq.patrol_one_v2.unbrand/rmbq.patrol_one_v2.SettingsActivity} from uid 10063 on display 0
02-23 22:19:17.022 1493-1657/system_process W/AppOps: Bad call: specified package com.google.android.gms under uid 10063 but it is really 10007
02-23 22:19:17.023 1493-1806/system_process W/AppOps: Bad call: specified package com.google.android.gms under uid 10063 but it is really 10007
02-23 22:19:17.023 1493-1941/system_process W/AppOps: Bad call: specified package com.google.android.gms under uid 10063 but it is really 10007
02-23 22:19:17.025 1493-1938/system_process W/AppOps: Bad call: specified package com.google.android.gms under uid 10063 but it is really 10007
02-23 22:19:17.055 1493-1519/system_process I/ActivityManager: Displayed rmbq.patrol_one_v2.unbrand/rmbq.patrol_one_v2.SettingsActivity: +58ms
02-23 22:19:17.081 1493-1508/system_process I/ActivityManager: START u0 {act=com.google.android.gms.signin.action.SIGN_IN cmp=com.google.android.gms/.signin.activity.SignInActivity (has extras)} from uid 10007 on display 0
02-23 22:19:17.083 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.signin.activity.SignInActivity}
02-23 22:19:17.083 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.signin.activity.SignInActivity} to Chimera activity impl .signin.activity.SignInChimeraActivity
02-23 22:19:17.090 1493-1807/system_process I/ActivityManager: START u0 {act=com.google.android.gms.common.account.CHOOSE_ACCOUNT_USERTILE pkg=com.google.android.gms cmp=com.google.android.gms/.common.account.AccountChipAccountPickerActivity (has extras)} from uid 10007 on display 0
02-23 22:19:17.111 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.common.account.AccountChipAccountPickerActivity}
02-23 22:19:17.111 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.common.account.AccountChipAccountPickerActivity} to Chimera activity impl .common.account.AccountChipAccountPickerChimeraActivity
02-23 22:19:17.151 1493-1519/system_process I/ActivityManager: Displayed com.google.android.gms/.common.account.AccountChipAccountPickerActivity: +58ms (total +69ms)
02-23 22:19:19.007 1493-1559/system_process W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client
02-23 22:19:19.040 2481-2780/com.google.android.gms.ui D/OpenGLRenderer: endAllStagingAnimators on 0x7fc245fd7400 (ListView) with handle 0x7fc25aa627e0
02-23 22:19:19.059 2481-2481/com.google.android.gms.ui D/StrictMode: Wrote violation #0 of 3: 12720 bytes
02-23 22:19:19.061 2030-2044/com.google.android.gms D/StrictMode: Wrote violation #0 of 3: 13676 bytes
02-23 22:19:19.221 1120-1120/? W/SurfaceFlinger: couldn't log to binary event log: overflow.
02-23 22:19:19.341 1889-2403/com.google.android.gms.persistent W/ContentTaskController: Invalid task was provided to stopTracking.
02-23 22:19:19.375 1493-1808/system_process W/AppOps: Bad call: specified package com.google.android.gms under uid 10063 but it is really 10007
02-23 22:19:19.381 1889-2220/com.google.android.gms.persistent I/art: Explicit concurrent mark sweep GC freed 55504(3MB) AllocSpace objects, 13(214KB) LOS objects, 30% free, 9MB/13MB, paused 136us total 12.142ms
02-23 22:19:19.383 1493-2523/system_process I/ActivityManager: START u0 {act=com.google.android.gms.signin.action.SIGN_IN cmp=com.google.android.gms/.signin.activity.SignInActivity (has extras)} from uid 10007 on display 0
02-23 22:19:19.386 1889-1889/com.google.android.gms.persistent W/GLSUser: [DeviceKeyStore] Cannot load key: Device key file not found.
02-23 22:19:19.391 1131-1530/? E/Drm: Failed to find drm plugin
02-23 22:19:19.391 2559-2904/com.google.android.gms.unstable W/DG.WV: Widevine DRM not supported on this device
android.media.UnsupportedSchemeException: Failed to instantiate drm object.
at android.media.MediaDrm.native_setup(Native Method)
at android.media.MediaDrm.<init>(MediaDrm.java:180)
at obk.a(:com.google.android.gms:119)
at nyd.run(:com.google.android.gms:1092)
at kzi.run(:com.google.android.gms:450)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at ldm.run(:com.google.android.gms:17)
at java.lang.Thread.run(Thread.java:818)
02-23 22:19:19.392 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.signin.activity.SignInActivity}
02-23 22:19:19.392 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.signin.activity.SignInActivity} to Chimera activity impl .signin.activity.SignInChimeraActivity
02-23 22:19:19.393 1493-1657/system_process I/ActivityManager: START u0 {act=com.google.android.gms.common.account.CHOOSE_ACCOUNT_USERTILE pkg=com.google.android.gms cmp=com.google.android.gms/.common.account.AccountChipAccountPickerActivity (has extras)} from uid 10007 on display 0
02-23 22:19:19.411 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Loading activity implementation for ComponentInfo{com.google.android.gms/com.google.android.gms.common.account.AccountChipAccountPickerActivity}
02-23 22:19:19.411 2481-2481/com.google.android.gms.ui D/ChimeraActivityProxy: Proxying container activity ComponentInfo{com.google.android.gms/com.google.android.gms.common.account.AccountChipAccountPickerActivity} to Chimera activity impl .common.account.AccountChipAccountPickerChimeraActivity
02-23 22:19:19.412 2481-2481/com.google.android.gms.ui D/StrictMode: Wrote violation #0 of 3: 16236 bytes
02-23 22:19:19.453 1493-1519/system_process I/ActivityManager: Displayed com.google.android.gms/.common.account.AccountChipAccountPickerActivity: +58ms (total +70ms)
02-23 22:19:20.164 1493-1571/system_process D/TaskPersister: removeObsoleteFile: deleting file=135_task.xml
02-23 22:19:20.164 1493-1571/system_process D/TaskPersister: removeObsoleteFile: deleting file=135_task_thumbnail.png
02-23 22:19:21.876 1889-2478/com.google.android.gms.persistent W/Conscrypt: Could not set socket write timeout: null
02-23 22:19:21.911 1889-2478/com.google.android.gms.persistent W/Conscrypt: Could not set socket write timeout: null
02-23 22:19:22.311 1889-2478/com.google.android.gms.persistent W/GLSUser: [AppCertManager] IOException while requesting key:
java.io.IOException: Invalid device key response.
at enr.a(:com.google.android.gms:282)
at enr.a(:com.google.android.gms:4237)
at enq.a(:com.google.android.gms:46)
at enk.a(:com.google.android.gms:53)
at enj.a(:com.google.android.gms:111)
at com.google.android.gms.auth.account.be.legacy.AuthCronChimeraService.b(:com.google.android.gms:4052)
at dxg.call(:com.google.android.gms:2043)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at kzi.run(:com.google.android.gms:450)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at ldm.run(:com.google.android.gms:17)
at java.lang.Thread.run(Thread.java:818)
02-23 22:19:22.312 1889-2403/com.google.android.gms.persistent W/ContentTaskController: Invalid newTask was provided to startTracking.

最佳答案

我的问题中的所有步骤都是正确的,但我遗漏了一个:

使用我的 SHA1 和包名称在谷歌开发者控制台中创建一个 ID 客户端 OAuth 2.0。

编辑:

经过一些测试不需要API KEY,只需要ID客户端OAuth 2.0

关于android - 在 android 上使用 google drive api_key,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42425039/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com