I need to integrate some Firebase products/features (Authentication, Cloud Storage and Realtime Database) into my Cocos2d-x C++ project for Android.
Can I do it without SDKBOX ?
I build for Android on Windows7 with console (“compile” command, not with Android Studio). My IDE is Visual Studio 2015.
So, also it would be good to compile for Windows - Firebase says it is possible: https://firebase.google.com/docs/cpp/setup?platform=android#desktop-workflow …it would be very good to compile everything for debug under VS 2015; but the main goal is to use it on Android.
Cocos compile:
From version 4.0 it uses CMakeLists.txt
Earlier versions (3.17.2) uses proj.android\app\jni\Android.mk
– to import sdkbox facebook for example.
On Firebase page there are some examples:
Firebase Cocos2d-x Samples (AdMob, Analytics, Authentication, Cloud Messaging, Invites, Remote Config) - dated 2017 so it uses proj.android-studio\app\jni\Android.mk
(alas I use proj.android\app\jni\Android.mk)
Firebase Realtime Database Quickstart - newer; it uses CMakeLists.txt but is not fitted for Cocos.
I’ve tried to compile both and get some confusing errors.
Could someone help me? I mean who have succeed to build Firebase products/features with Cocos for Android (with console compile on Windows)?
Hello, I can help you, I had add Firebase Framework to iOS and Adroid in Cocos2d-x 3.17 and Cocos2d-x 4.0 in my project, you should compile android with Android Studio
You can always use the native sdks and write some small JNI functions for any specific things you need firebase for… that’s what I ended up doing. On iOS as well with ObjC++… Just another option.
Ok, I’ve succeed to compile apk for my Firebase Realtime Database project – using Android Studio. …To do that I had to google really a lot.
Trying to debug and to code via Android Studio – it is very slow comparing to Visual Studio.
I’ve succeed to compile my project with VS 2015 and to debug it running in Windows 7 – I can connect to my project Firebase Realtime Database, I can change some value or create some child (running or debugging in Windows), but I can not perform: GetValue() SetValue() RemoveValue() AddValueListener()
– I get Exception thrown at 0x0059E53F in my_project_name.exe: 0xC0000005: Access violation reading location 0x00000028.
But I can execute: GetReference(); current_user(); SignInAnonymously(); – and I see that connection in firebase console.
Q: Had anyone succeed to work fully with Firebase Realtime Database from app compiled for Windows?
@tdebock
Would you mind sharing your rationale for using native sdks rather than the c++ one?
I’m considering using Firebase C++ SDK, I have it setup and working, but the example code looks like it’s much more of a hassle to write anything in c++ that using native sdks. Even though I consider myself a fairly decent c++ programmer. (OK, maybe not SUPER advanced, but not so clumsy either. Enough to have a couple of small leak-free games out there ). My idea was, obviously, to write the code once for iOS and Android, but actually I’m worried that it will still be faster, easier and safer/more stable/less bug-prone to just write it in ObjC / Java.
Were these your reasons as well? I’m wondering what to do.