Firebase integration (compile) without SDKBOX?

Hello.

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

1.- Check If you have Android Studio. Last version it is betters. https://developer.android.com/studio/?gclid=EAIaIQobChMIrNm0msGB6QIVUfDACh0IMgvuEAAYASAAEgKCXPD_BwE&gclsrc=aw.ds

2.- Check if you have Android NDK download in your PC. I you don’t have, you can download for this https://developer.android.com/ndk/downloads version android-ndk-r12b

3.- Check the setup Java8, JAVA_HOME, in variable environment.

4.- Try to compile your project, open proj.android-studio with Android Studio, you should wait that android studio download all dependencies.

5.- Plase check this git check this git https://github.com/FirebaseExtended/cocos2dx-cpp-sample.

6.- Check the readme of this git and create some examples. you don’t try to compile this git project in Cocos2d-x 4.0 version, check the code samples.

I have a sample Cocos2d-x 4.0 with Firebase Real time data base run just now.

Let me know, how are you going?

1 Like

1.- Check If you have Android Studio

– I don’t use it, I compile via command prompt with “cocos compile …”

5.- Please check this git

– Alas it shows “This site can’t be reached”.
Browsing without “my” asks to login – seems I don’t have the access there.

Thank you.
Later I will try your offers with Android Studio, but only after I free few GB on my disk :slight_smile:
…If there is no solution without Android Studio.

Sorry, I’m worng the link please check it https://github.com/FirebaseExtended/cocos2dx-cpp-sample

Can you compile you project with cocos run -p android?

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. :frowning:

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 :stuck_out_tongue: ). 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.