Hi, Dear all…
i’m success integration Google Play Game Service with CocosCreator,
My envronment config is…
-
android api level: 17
-
android ndk: r10e
-
i have copy the android-support-v4.jar from sdkbox-sample-gpg to fix the “-3” return code.
-
SDKBOX - Plugin Version: 1.0.4
-
Plugin Version:
-
build settings:
i build the release mode apk to running on my Phone,
always get error of
Exception in com/google/android/gms/games/Games.getGamesServerAuthCode: java.lang.IllegalArgumentException: Please provide a valid serverClientId.
here is my JavaScript code… ( copy from doc-googleplay-v3-js )
var config = new gpg.PlatformConfiguration();
config.SetClientID('239759943429-3v8bd9ea3j1vcmq7c965ic8deq7gs2gh.apps.googleusercontent.com');
cc.log( '[GPG] Start Build Game Service.' );
new gpg.GameServices.Builder()
.SetOnAuthActionStarted( function( result )
{
cc.log( '[GPG] on auth started: ' + result.AuthOperation + '\n' );
})
.SetOnAuthActionFinished( function( result )
{
cc.log( '[GPG] on auth finished: ' + result.AuthOperation + ' -> ' + result.AuthStatus + '\n';
})
.SetLogging( gpg.LogLevel.VERBOSE ) // Set Logging level
.EnableSnapshots() // Enable Snapshot (Saved Game) functionailty
.Create( function( game_services )
{
cc.log( 'Game Services Created!!!!\n' );
} );
cc.log( '[GPG] End Build Game Service.' );
and my part adb log is…
V/GamesNativeSDK(20912): Play Games callback indicates connection.
W/GamesServiceBroker( 4298): Client connected with SDK 8487000, Services 10298030, and Games 39080030
I/GamesNativeSDK(20912): Successfully connected to Google Play.
V/GamesNativeSDK(20912): WelcomeBack Notification UI should be displayed by GMSCore.
V/GamesNativeSDK(20912): ApplicationMetadataCache is not being seeded; this is normal on non-iOS platforms.
V/GamesNativeSDK(20912): PlayerLevelCache is not being seeded; this is normal on Android.
V/GamesNativeSDK(20912): QuestCache is not being seeded; this is normal on Android.
D/dalvikvm( 4298): GC_FOR_ALLOC freed 502K, 48% free 15774K/30120K, paused 36ms, total 36ms
I/dalvikvm-heap( 4298): Grow heap (frag case) to 17.425MB for 921616-byte allocation
E/SMD (20633): smd Interface open failed errno is 2 -1
D/dalvikvm( 4298): GC_FOR_ALLOC freed 19K, 47% free 16655K/31024K, paused 32ms, total 32ms
E/GamesNativeSDK(20912): Exception in com/google/android/gms/games/Games.getGamesServerAuthCode: java.lang.IllegalArgumentException: Please provide a valid serverClientId.
F/libc (20912): !@Fatal signal 11, thread 20956
F/libc (20912): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 20956 (main_dispatch)
W/AppOps ( 3383): Bad call: specified package com.google.android.play.games under uid 10291 but it is really 10127
W/AppOps ( 3383): Bad call: specified package com.google.android.play.games under uid 10291 but it is really 10127
W/AppOps ( 3383): Bad call: specified package com.google.android.play.games under uid 10291 but it is really 10127
W/AppOps ( 3383): Bad call: specified package com.google.android.play.games under uid 10291 but it is really 10127
I/DEBUG ( 2824): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 2824): Build fingerprint: 'samsung/trhpltexx/trhplte:4.4.4/KTU84P/N910UXXU1ANL4:user/release-keys'
full log is here : adb.log.zip (28.4 KB)
just look from line: 1634
you can see the GamesNativeSDK says “Successfully connected to Google Play.”
but next get Exception in “Games.getGamesServerAuthCode”…
my strings.xml is
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="app_name" translatable="false">SDKBOX</string>
<string name="google_app_id">239759943429</string>
<string name="service_id">tw.raz.SDKBOX.test.nearby</string>
</resources>
and my AndroidManifest.xml is…
<?xml version='1.0' encoding='UTF-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tw.raz.SDKBOX" android:installLocation="auto">
<uses-feature android:glEsVersion="0x00020000" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name">
<meta-data android:name="android.app.lib_name" android:value="cocos2djs" />
<activity android:configChanges="orientation|keyboardHidden|screenSize" android:label="@string/app_name" android:name="org.cocos2dx.javascript.AppActivity" android:screenOrientation="sensorLandscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/google_app_id" />
<meta-data android:name="com.google.android.gms.nearby.connection.SERVICE_ID" android:value="@string/service_id" />
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity" android:theme="@android:style/Theme.Translucent" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
</manifest>
i don’t know why i’m always get the error,
alos trying google it by no any useful information…
anyone can tell me what’s wrong with my step?
thank you so much