play-games-plugin-for-unity.Status from wire:NeedPermission状态:NEED_PERMISSION

时间:2014-03-07 12:04:10

标签: android unity3d google-plus google-play-services google-play-games

我正在使用play-games-plugin-for-unity 0.8.01。 我设置了所有配置(androidmanifest.xml,ids.xml,谷歌播放控制台等等),iOS成功。 但是Android(Galaxy S2 LTE)在“Social.localUser.Authenticate”中失败了。

代码是

    Social.localUser.Authenticate((bool success) => {
        // handle success or failure
        if (success) {
            Debug.Log("Login Success");
            loginflag = true;
        } else {
            ((PlayGamesPlatform) Social.Active).SignOut();
            Debug.Log("Login Failed");
        }
    });

这是我在Logcat中得到的日志:

I/Unity   (15007): [Play Games Plugin DLL] AUTH: Initial achievement load call made.
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
W/SurfaceFlinger(  164): id=745 Removed idx=4 Map Size=5
W/GameHelper(15007): GameHelper: client was already connected on onStart()
W/SurfaceFlinger(  164): id=745 Removed idx=-2 Map Size=5
D/PluginSupport/SignInHelperActivity(15007): onStop()
D/GameHelper(15007): GameHelper: onStop
D/GameHelper(15007): GameHelper: Disconnecting client due to onStop
I/AchievementAgent( 5962): Sending achievement batch...
W/GLSUser ( 5925): GoogleAccountDataService.getToken()
V/GLSUser ( 5925): DEBUG: loginOption to be added: clientPackageName
V/GLSUser ( 5925): DEBUG: loginOption to be added: callerUid
V/GLSUser ( 5925): DEBUG: loginOption to be added: request_visible_actions
V/GLSUser ( 5925): DEBUG: loginOption to be added: androidPackageName
V/GLSUser ( 5925): DEBUG: loginOption to be added: suppressProgressScreen
I/APACHE HTTP (thCr=3674) - NafHttpAuthStrategyDefault( 5925): (thUse=3723)    cached value : gbaSupportIsPossible=false
I/APACHE HTTP (thCr=3674) - NafHttpAuthStrategyDefault( 5925): (thUse=3723) It is impossible to support GBA now (many possible reasons: no Android Context, current client is GBA service, etc.), then it will be just usual HTTP.
I/APACHE HTTP (thCr=3723) - NafRequestExecutorWrapperRedirectionHandler( 5925): (thUse=3723)    It isn't GBA flow, redirection responses are not handled.
I/AndroidHttpClient$2( 5925): executeRequestSending()   director.getClass()=class org.apache.http.impl.client.DefaultRequestDirector
I/AndroidHttpClient$2( 5925): execute()   finalHttpResponse.getStatusLine()=HTTP/1.1 200 OK
I/AndroidHttpClient$2( 5925): execute()#finished

W/GLSActivity( 5925): [anc] Status from wire: NeedPermission status: NEED_PERMISSION
E/DataHolderOperation( 5962): Auth error while performing operation, requesting reconnect
E/DataHolderOperation( 5962): alg: NeedPermission
E/DataHolderOperation( 5962):   at akt.a(SourceFile:371)
E/DataHolderOperation( 5962):   at bjn.b(SourceFile:91)
E/DataHolderOperation( 5962):   at biy.b(SourceFile:834)
E/DataHolderOperation( 5962):   at dec.b(SourceFile:133)
E/DataHolderOperation( 5962):   at biy.b(SourceFile:451)
E/DataHolderOperation( 5962):   at biy.a(SourceFile:421)
E/DataHolderOperation( 5962):   at biy.a(SourceFile:400)
E/DataHolderOperation( 5962):   at dec.a(SourceFile:147)
E/DataHolderOperation( 5962):   at coz.a(SourceFile:676)
E/DataHolderOperation( 5962):   at coz.a(SourceFile:637)
E/DataHolderOperation( 5962):   at coz.a(SourceFile:1055)
E/DataHolderOperation( 5962):   at coz.a(SourceFile:980)
E/DataHolderOperation( 5962):   at cph.b(SourceFile:1403)
E/DataHolderOperation( 5962):   at dko.b(SourceFile:33)
E/DataHolderOperation( 5962):   at dkb.a(SourceFile:47)
E/DataHolderOperation( 5962):   at com.google.android.gms.games.service.GamesIntentService.a(SourceFile:617)
E/DataHolderOperation( 5962):   at bcd.run(SourceFile:150)
E/DataHolderOperation( 5962):   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
E/DataHolderOperation( 5962):   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/DataHolderOperation( 5962):   at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/DataHolderOperation( 5962):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
E/DataHolderOperation( 5962):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
E/DataHolderOperation( 5962):   at java.lang.Thread.run(Thread.java:856)
I/Unity   (15007): [Play Games Plugin DLL] OnAchievementsLoadedResultProxy invoked
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
I/Unity   (15007): [Play Games Plugin DLL]     result=UnityEngine.AndroidJavaObject
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
I/Unity   (15007): [Play Games Plugin DLL] AUTH: Initial achievement load finished.
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
W/Unity   (15007): !!! [Play Games Plugin DLL]  WARNING: AUTH: Failed to load achievements, status code 2
W/Unity   (15007):  
W/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
W/Unity   (15007): 
I/Unity   (15007): [Play Games Plugin DLL] AUTH: Calling auth callback: success=False
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
I/Unity   (15007): [Play Games Plugin DLL] AndroidClient.SignOut
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
I/Unity   (15007): [Play Games Plugin DLL] Action scheduled for later (connection currently in progress).
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
I/Unity   (15007): [Play Games Plugin DLL] AndroidClient.SignOut
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
I/Unity   (15007): [Play Games Plugin DLL] Action scheduled for later (connection currently in progress).
I/Unity   (15007):  
I/Unity   (15007): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)
I/Unity   (15007): 
I/Unity   (15007): Google Login Failed

显示权限如下:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

并在下面添加:

    <meta-data android:name="android.app.lib_name" android:value="unity" />
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
    <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/app_id" />
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

尽管尝试或搜索了各种方法,但解决方案完全不受不能做的困扰。 它会一次签出,如果它再次尝试,就不可能再次在错误中登录,尽管它可能很少成功。 我想以某种方式解决 - 律师 - 我会感激你的帮助。

抱歉我的英语不好。

2 个答案:

答案 0 :(得分:1)

如果您在特定设备上遇到错误的NEEDS_PERMISSION错误,您可以检查设备上的时钟吗?如果它太不同步,那么来自Google的授权可能会在用户被标记为已登录之前到期。

答案 1 :(得分:0)

我自己解决了这个问题。

抱歉,我在Android上删除了google目录。

所以,我播放了另一个谷歌成就的应用程序,该应用程序又制作了另一个谷歌api。 我的Android制作了google目录(也许是com.android.apps.genie.geniewidget.news-content-cache或com.google.android.youtube)。 然后,这个问题不会发生。

也许,play-games-plugin-for-unity有一个问题,即必要的目录如果不存在则不会。 所以,现在我搜索这个解决方案。