Crashing on firebase::app::Create
crazyhatfish opened this issue · 2 comments
Library
Firebase C++ SDK: 4.0.2
Problem
Been adding the Firebase SDK to an Android application which has been going relatively smoothly (looks like a well-designed SDK btw) but when it hits:
Env::app = firebase::App::Create(firebase::AppOptions(), JniHelper::getEnv(), JniHelper::getActivity());
It crashes with jmethodID was NULL
.
Additional Information
I've checked the output of JniHelper::getEnv()
and JniHelper::getActivity()
and they look valid. It also complains about the missing methods as in issue #7.
I imagine that the SDK code that calls CallObjectMethodV
attempts to get a jmethodID
for a method but fails (am I right in thinking their arn't any required Java methods for the Android C++ SDK to work?) and nothing picks up that failure so CallObjectMethodV
is called with a null argument.
Stack Trace
07-09 22:41:59.173 5290-5343/PACKAGE_NAME W/System.err: java.lang.NoSuchMethodError: no non-static method "Lcom/google/firebase/FirebaseOptions;.getProjectId()Ljava/lang/String;"
07-09 22:41:59.173 5290-5343/PACKAGE_NAME W/System.err: at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native Method)
07-09 22:41:59.173 5290-5343/PACKAGE_NAME W/System.err: at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:73)
07-09 22:41:59.173 5290-5343/PACKAGE_NAME W/System.err: at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1539)
07-09 22:41:59.173 5290-5343/PACKAGE_NAME W/System.err: at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
07-09 22:41:59.180 5290-5343/PACKAGE_NAME W/zygote: Skipping duplicate class check due to unrecognized classloader
07-09 22:41:59.181 5290-5316/PACKAGE_NAME D/FA: Connected to remote service
07-09 22:41:59.182 5290-5316/PACKAGE_NAME V/FA: Processing queued up service tasks: 2
07-09 22:41:59.201 5290-5343/PACKAGE_NAME I/firebase: Firebase App initializing app PACKAGE_NAME (default 1).
>>> CRASH >>>
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: jmethodID was NULL
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] in call to CallObjectMethodV
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] from void org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(int, int)
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] "GLThread 236" prio=5 tid=17 Runnable
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] | group="main" sCount=0 dsCount=0 flags=0 obj=0x12f695b8 self=0xa16f8c00
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] | sysTid=5343 nice=0 cgrp=default sched=0/0 handle=0x9078b970
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] | state=R schedstat=( 57357316 35185279 53 ) utm=2 stm=3 core=1 HZ=100
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] | stack=0x90689000-0x9068b000 stackSize=1038KB
07-09 22:41:59.266 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] | held mutexes= "mutator lock"(shared held)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #00 pc 0047358b /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+203)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #01 pc 0056ee2e /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+366)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #02 pc 005696b3 /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+83)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #03 pc 00385e3e /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1374)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #04 pc 003863c1 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_Pc+113)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #05 pc 0014ea45 /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+69)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #06 pc 0014e2c8 /system/lib/libart.so (_ZN3art11ScopedCheck13CheckMethodIDEP10_jmethodID+232)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #07 pc 0014d191 /system/lib/libart.so (_ZN3art11ScopedCheck22CheckPossibleHeapValueERNS_18ScopedObjectAccessEcNS_12JniValueTypeE+289)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #08 pc 0014c6b3 /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1155)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #09 pc 001524d9 /system/lib/libart.so (_ZN3art8CheckJNI13CheckCallArgsERNS_18ScopedObjectAccessERNS_11ScopedCheckEP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDNS_10InvokeTypeEPKNS_7VarArgsE+185)
07-09 22:41:59.267 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #10 pc 0015161d /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDPcNS_9Primitive4TypeENS_10InvokeTypeE+1133)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #11 pc 0013b73b /system/lib/libart.so (_ZN3art8CheckJNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDPc+75)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #12 pc 00494737 /data/app/PACKAGE_NAME-wnt1NlfuJlTadMzzuYlqPw==/lib/x86/libMyGame.so (???)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #13 pc 0049e30c /data/app/PACKAGE_NAME-wnt1NlfuJlTadMzzuYlqPw==/lib/x86/libMyGame.so (???)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #14 pc 0049e8df /data/app/PACKAGE_NAME-wnt1NlfuJlTadMzzuYlqPw==/lib/x86/libMyGame.so (_ZN8firebase3App6CreateERKNS_10AppOptionsEPKcP7_JNIEnvP8_jobject+501)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #15 pc 0049eba1 /data/app/PACKAGE_NAME-wnt1NlfuJlTadMzzuYlqPw==/lib/x86/libMyGame.so (_ZN8firebase3App6CreateERKNS_10AppOptionsEP7_JNIEnvP8_jobject+55)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #16 pc 004820dc /data/app/PACKAGE_NAME-wnt1NlfuJlTadMzzuYlqPw==/lib/x86/libMyGame.so (_ZN11AppDelegate29applicationDidFinishLaunchingEv+824)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #17 pc 004879ea /data/app/PACKAGE_NAME-wnt1NlfuJlTadMzzuYlqPw==/lib/x86/libMyGame.so (_ZN7cocos2d11Application3runEv+24)
07-09 22:41:59.272 5290-5343/PACKAGE_NAME A/zygote: java_vm_ext.cc:504] native: #18 pc 0048c5f4 /data/app/PACKAGE_NAME-wnt1NlfuJlTadMzzuYlqPw==/lib/x86/libMyGame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+223)
Looking for some quick clarification: I notice your callstack has cocos functions in it. Is this callstack from the firebase cocos2d-x sample app, or from a custom cocos app? If this crash was happening in the cocos sample app, I've recently updated the gradle build files to include the correct firebase library version (version 11.0.0, rather than 10.2.0). If this is a custom cocos app, can you verify for me that you're using the most up to date version of the library (11.0.0)? If everything is up to date and you're still seeing this let me know and I'll help you dig deeper.
This is a custom integration to a cocos app. I upgraded the library to 11.0.2, which is what I saw the updated documentation now says, and added the dependency to com.google.android.gms:play-services-base:11.0.2
and it no longer crashes. Thanks a lot!