Hi, thank you for gpg 2.4.0.3
i had some issue, how do i know i gpg is define in release build?
is the code below able to run?
or is there any wrong?
because i didnt see pop up google play sign in.
please help.
Hi, thank you for gpg 2.4.0.3
i had some issue, how do i know i gpg is define in release build?
is the code below able to run?
or is there any wrong?
because i didnt see pop up google play sign in.
please help.
what’s the error message ?
try release mode
i use cocos 3.17 to test, this is my steps:
sdkbox gpg
frameworks/runtime-src/proj.android/app/build.gradle
like fellow:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':libcocos2dx')
implementation 'com.google.android.gms:play-services-games:15.0.1'
implementation 'com.google.android.gms:play-services-nearby:15.0.1'
implementation 'com.android.support:support-v4:27.1.1'
}
./src/app.js
var HelloWorldLayer = cc.Layer.extend({
sprite:null,
ctor:function () {
.....
this.createMenu();
this.test();
return true;
},
createMenu: function() {
const self = this;
const winSize = cc.Director.getInstance().getWinSize();
cc.MenuItemFont.setFontName("sans");
const menu = new cc.Menu(
new cc.MenuItemFont("SignIn", function() {
if (null == self.gameServices) {
cc.log('GPG game services is null');
return;
}
if (self.signIn) {
cc.log('GPG to sign out ...');
self.gameServices.SignOut();
} else {
cc.log('GPG to sign in ...');
self.gameServices.StartAuthorizationUI();
}
})
);
menu.alignItemsVerticallyWithPadding(3);
menu.x = winSize.width / 2;
menu.y = winSize.height / 2 + 40;
this.addChild(menu);
},
test: function() {
cc.log('GPG test entry');
const self = this;
this.gameServices = null;
this.signIn = false;
const config = new gpg.PlatformConfiguration();
config.SetClientID('777734739048-cdkbeieil19d6pfkavddrri5o19gk4ni.apps.googleusercontent.com');
new gpg.GameServices.Builder()
.SetOnAuthActionStarted (
function(result) {
cc.log('GPG on auth action start');
}
).SetOnAuthActionFinished (
function(result) {
cc.log('GPG on auth action finished: ' + result.AuthOperation + ' ' + result.AuthStatus);
self.signIn = gpg.IsSuccess(result.AuthStatus);
cc.log('GPG signed in:' + self.signIn);
}
).SetOnMultiplayerInvitationEvent(
function(result) {
cc.log('GPG on multiplayer invitation');
}
).SetLogging(gpg.LogLevel.INFO)
.EnableSnapshots()
.Create(
function(gs) {
if (gs) {
self.gameServices = gs;
cc.log('GPG game services connect');
} else {
cc.log('GPG game services not connect')
}
}, config);
}
});
frameworks/runtime-src/proj.android/app/res/values/strings.xml
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="app_name">jsTest317</string>
<string name="google_app_id">777734739048</string>
<string name="service_id">com.sdkbox.hugo.test.gpg.nearby</string>
</resources>
Google Play Games Services: https://developers.google.com/games/services/cpp/gettingStartedAndroid
hi @htlxyz,
thank you for used your time to give me example super detail way.
I tried and try to follow your steps, and i use cocos creator, maybe there are some different.
and used your google_app_id.
I use release mode, my screen don’t do anything and i do not know what error i have.
once i build debug mode,
it show
E/jswrapper(16808): ERROR: Uncaught ReferenceError: gpg is not defined, location: src/project.dev.js:0:0
still having this gpg is not defined long time ago until i use gpg 2.4.0.3.
still the same issue.
maybe gpg is not regiested to js.
check this: https://github.com/sdkbox/sdkbox-sample-gpg/blob/master/js/frameworks/runtime-src/Classes/AppDelegate.cpp#L78
i had check in my folder, and it is there.
\TestGpg\build\jsb-default\frameworks\runtime-src\Classes\AppDelegate.cpp
it is because i need to use your release keystore?
i guess i figure out.
creator will clean build/jsb-link/res
folder when compile project every time.
this is our issue, we will fix it ASAP.
for now, you can cp ~/.sdkbox/plugins/sdkbox-gpg_v2.4.1.0/plugin/jsbindings/sdkboxgpg.js ./build/jsb-link/res
temporary.
UPDATE:
this is auto backup sdkboxgpg.js creator plugin.
with this plugin, you needn’t run cp sdkboxgpg.js
every time after compile proejct.
unzip gpgbackup.zip and put under your creator project packages folder.
gpgbackup.zip (949 Bytes)
i’m using Cocos Creator v1.10.1.
after i update gpg to 2.4.1.1
i get back the error again
E/jswrapper( 6790): ERROR: Uncaught ReferenceError: gpg is not defined, location: src/project.dev.js:0:0
even use the last time @htlxyz gave me gpgbackup also same.
Can help me check please?
I can not reproduce.
plz save https://raw.githubusercontent.com/sdkbox/sdkbox-sample-ccc200/gpg/build/jsb-link/res/sdkboxgpg.js to res
and try build
again, maybe you delete the sdkboxgpg.js
file before you build
it.
I used default build.
i create and save sdkboxgpg.js and put in res, follow as you said.
and it become fail to compile.
the error showed inside this text file.
native.zip (38.2 KB)
please help me to look at it.
thanks
seems there are two facebook libs:
find . -name "facebook_*"
and delete them.
thanks for help.
I’m using Window10, sorry not sure how to remove duplicate facebook,
so i remove jsb-default folder and build again, import facebook and google service again,
and it works.
i wonder why when press build will delete sdkboxgpg.js and won’t generate back.