Android Unity 3D插件的Google驱动器授权错误

Android Unity 3D插件的Google驱动器授权错误,android,unity3d,google-oauth,google-drive-api,Android,Unity3d,Google Oauth,Google Drive Api,我对Android应用程序的Google Drive服务有问题。 这是一个Unity 3D项目,其中包括一个使用Google Drive API的插件 我已经在PC版本上使用了这个插件,它工作得很好。Oauth2授权工作,我得到一个工作令牌,我可以从登录的Google用户帐户的Google驱动器写入、删除、下载等文件。在PC上,该插件使用web请求与google drive通信 但当我尝试在Android设备上使用该插件时,我无法授权并从谷歌服务获得Oauth2令牌。在Android设备上,该插

我对Android应用程序的Google Drive服务有问题。 这是一个Unity 3D项目,其中包括一个使用Google Drive API的插件

我已经在PC版本上使用了这个插件,它工作得很好。Oauth2授权工作,我得到一个工作令牌,我可以从登录的Google用户帐户的Google驱动器写入、删除、下载等文件。在PC上,该插件使用web请求与google drive通信

但当我尝试在Android设备上使用该插件时,我无法授权并从谷歌服务获得Oauth2令牌。在Android设备上,该插件使用google drive API。 我认为这个错误源于我的Manifest.xml,因为我仍然不确定它到底应该包含什么

错误消息:

I/Unity   (17269): Start Authorization
D/Unity-GoogleDrivePlugin(17269): setUnityActivity: com.unity3d.player.UnityPlayerNativeActivity@423bbdd0
D/Unity-GoogleDrivePlugin(17269): auth with accountName: dino******@******.com
W/AbstractGoogleClient(17269): Application name is not set. Call Builder#setApplicationName.
D/Unity-GoogleDrivePlugin(17269): google drive service: com.google.api.services.drive.Drive@423aa280
W/dalvikvm(17269): VFY: unable to resolve static field 634 (auth_client_play_services_err_notification_msg) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x001a
I/dalvikvm(17269): DexOpt: unable to optimize static field ref 0x027b at 0x42 in Lcom/google/android/gms/auth/GoogleAuthUtil;.a
I/dalvikvm(17269): DexOpt: unable to optimize static field ref 0x0279 at 0x4d in Lcom/google/android/gms/auth/GoogleAuthUtil;.a
W/dalvikvm(17269): VFY: unable to resolve static field 642 (common_google_play_services_install_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x0041
W/dalvikvm(17269): VFY: unable to resolve static field 638 (common_google_play_services_enable_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x004c
W/dalvikvm(17269): VFY: unable to resolve static field 648 (common_google_play_services_update_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x0057
W/dalvikvm(17269): VFY: unable to resolve static field 645 (common_google_play_services_unsupported_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x0069
W/dalvikvm(17269): VFY: unable to resolve static field 639 (common_google_play_services_install_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x0009
W/dalvikvm(17269): VFY: unable to resolve static field 636 (common_google_play_services_enable_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x0010
W/dalvikvm(17269): VFY: unable to resolve static field 646 (common_google_play_services_update_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x0017
W/dalvikvm(17269): VFY: unable to resolve static field 643 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
D/dalvikvm(17269): VFY: replacing opcode 0x60 at 0x0004
I/dalvikvm(17269): DexOpt: unable to optimize static field ref 0x0281 at 0x18 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.c
I/dalvikvm(17269): DexOpt: unable to optimize static field ref 0x0280 at 0x38 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.c
I/dalvikvm(17269): DexOpt: unable to optimize static field ref 0x027d at 0x3f in Lcom/google/android/gms/common/GooglePlayServicesUtil;.c
I/dalvikvm(17269): DexOpt: unable to optimize static field ref 0x0287 at 0x46 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.c
I/dalvikvm(17269): DexOpt: unable to optimize static field ref 0x0284 at 0x66 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.c
W/GLSUser ( 5447): GoogleAccountDataService.getToken()
W/GLSActivity( 5447): [art] Status from wire: INVALID_KEY status: null
W/GLSActivity( 5447): [art] Status from wire: INVALID_KEY status: null
I/GLSUser ( 5447): GLS error: INVALID_KEY dino******@******.com oauth2:https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.appdata
W/GLSActivity( 5447): [art] Status from wire: Unknown status: UNKNOWN
E/Unity-GoogleDrivePlugin(17269): checkAuthorized: com.google.android.gms.auth.GoogleAuthException: Unknown
I/Unity   (17269): GoogleDrive+Exception: Authorization failed.
我的舱单:

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

  <supports-screens 
    android:smallScreens="true" 
    android:normalScreens="true" 
    android:largeScreens="true" 
    android:xlargeScreens="true" 
    android:anyDensity="true" />

  <application 
    android:icon="@drawable/app_icon" 
    android:label="@string/app_name" 
    android:debuggable="false">

    <activity 
        android:name="com.unity3d.player.UnityPlayerProxyActivity" 
        android:label="@string/app_name" 
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" 
        android:screenOrientation="portrait">

      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>

    <activity 
        android:name="com.unity3d.player.UnityPlayerActivity" 
        android:label="@string/app_name" 
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" 
        android:screenOrientation="portrait">
    </activity>

    <activity 
        android:name="com.unity3d.player.UnityPlayerNativeActivity" 
        android:label="@string/app_name" 
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" 
        android:screenOrientation="portrait">
      <meta-data android:name="android.app.lib_name" android:value="unity" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    </activity>

    <activity 
        android:name="com.unity3d.player.VideoPlayer" 
        android:label="@string/app_name" 
        android:screenOrientation="behind" 
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    </activity>

    <activity 
        android:name="com.studio272.googledriveplugin.GoogleDrivePluginActivity" 
        android:theme="@android:style/Theme.Translucent.NoTitleBar">
        <meta-data android:name="com.google.android.apps.drive.APP_ID" android:value="id=318737920467" />
    </activity>
  </application>

  <uses-feature android:glEsVersion="0x00020000" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.INTERNET" />
  <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
</manifest>

我找到了解决方案。 在unity 3D中,我还必须说明unity应该使用什么密钥库和捆绑包来签署我的apk文件

因此,在“编辑->项目设置->播放器”下,然后在“Android->发布设置”部分,我必须浏览到我正在使用的密钥库,并输入密钥库的密码。同时选择“别名”并再次输入密码

此外,在“Android部分->其他设置”中,我必须从googledeveloper控制台将“Bundle Identifier”设置为我的包名

现在,OAuth2令牌的身份验证工作正常,我可以使用google drive。

类似问题: