I've got a cocos2d-x project that uses Ant and for legacy reasons cannot be converted to Android Studio. How can I integrate Firebase Analytics to it?
Official docs offer only the way to use Android Studio, gradle, and the Play Services plugin for gradle.
This blogpost and this repo describe a way to include Firebase Analytics for Eclipse-based projects, which is close enough for me: I can include jar files and edit xml-s manually.
However, I've run into a couple of problems with this approach:
First, where do you put the
values.xml
file that's converted fromgoogle-services.json
? Where is it used? I've copied those values into myres/values/strings.xml
file, but I'm not sure if it's the correct way.More important, after I've the build compiling and running on the device, it crashes with the following error in the logcat:
E/AndroidRuntime(18301): FATAL EXCEPTION: main
E/AndroidRuntime(18301): java.lang.NoClassDefFoundError: com.google.android.gms.R$string
E/AndroidRuntime(18301): at com.google.android.gms.common.internal.zzam.<init>(Unknown Source)
E/AndroidRuntime(18301): at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
E/AndroidRuntime(18301): at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
E/AndroidRuntime(18301): at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
E/AndroidRuntime(18301): at android.content.ContentProvider.attachInfo(ContentProvider.java:944)
E/AndroidRuntime(18301): at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
E/AndroidRuntime(18301): at android.app.ActivityThread.installProvider(ActivityThread.java:4237)
E/AndroidRuntime(18301): at android.app.ActivityThread.installContentProviders(ActivityThread.java:3992)
E/AndroidRuntime(18301): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3946)
E/AndroidRuntime(18301): at android.app.ActivityThread.access$1300(ActivityThread.java:123)
E/AndroidRuntime(18301): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
E/AndroidRuntime(18301): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(18301): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(18301): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(18301): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(18301): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(18301): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(18301): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(18301): at dalvik.system.NativeStart.main(Native Method)
Any ideas how to fix it?