【发布时间】:2014-04-10 13:44:25
【问题描述】:
我正在使用 play-games-plugin-for-unity 0.8.01。 我设置了所有配置(androidmanifest.xml、ids.xml、google play console 等),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" />
尽管尝试了各种方法或正在寻找各种方法,但解决方案完全被不做的能力所困扰。 它按原样注销一次,如果再次尝试,则无法再次登录相同的错误,尽管它可能很少成功。 我想以某种方式解决——建议——我会很感激你的青睐。
对不起,我的英语不好。
【问题讨论】:
-
来自电汇的状态:NeedPermission 状态:NEED_PERMISSION 这让我认为应用程序需要权限才能执行此操作,或者用户没有给您授权
-
感谢您的评论。但我已授权此应用程序,出现此错误。
标签: android unity3d google-plus google-play-services google-play-games