Firebase C ++ android NDK在firebase :: App :: Create

时间:2018-09-01 16:11:32

标签: c++ firebase firebase-authentication

在Android NDK中使用Firebase C ++ SDK时,在创建应用程序实例时出现SIGABRT崩溃

这是代码

Java_com_ramo_research_firebasendk_MainActivity_fireBaseTest(JNIEnv* env, jobject obj)
{
#if defined(__ANDROID__)
    firebase::App* app = firebase::App::Create(env, obj);
#else
    firebase::App* app = firebase::App::Create(firebase::AppOptions());
#endif  // defined(__ANDROID__)

}

这是崩溃的日志

 art/runtime/runtime.cc:427] JNI DETECTED ERROR IN APPLICATION: can't call java.lang.ClassLoader android.content.ContextWrapper.getClassLoader() on instance of java.lang.Class<com.ramo.research.firebasendk.MainActivity>
    art/runtime/runtime.cc:427]     in call to CallObjectMethodV
    art/runtime/runtime.cc:427]     from void com.ramo.research.firebasendk.MainActivity.fireBaseTest()
    art/runtime/runtime.cc:427] "main" prio=5 tid=1 Runnable
    art/runtime/runtime.cc:427]   | group="main" sCount=0 dsCount=0 obj=0x761919b8 self=0x7edfc9aa00
    art/runtime/runtime.cc:427]   | sysTid=8433 nice=-10 cgrp=default sched=0/0 handle=0x7ee4586a98
    art/runtime/runtime.cc:427]   | state=R schedstat=( 1011441306 5924305 129 ) utm=92 stm=8 core=4 HZ=100
    art/runtime/runtime.cc:427]   | stack=0x7ffb4fe000-0x7ffb500000 stackSize=8MB
    art/runtime/runtime.cc:427]   | held mutexes= "mutator lock"(shared held)
    art/runtime/runtime.cc:427]   native: #00 pc 0000000000481a58  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+220)
    art/runtime/runtime.cc:427]   native: #01 pc 0000000000481a54  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+216)
09-01 23:32:37.212 8433-8433/com.ramo.research.firebasendk A/art: art/runtime/runtime.cc:427]   native: #02 pc 0000000000455bb4  /system/lib64/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+480)
09-01 23:32:37.230 8433-8433/com.ramo.research.firebasendk A/art: art/runtime/runtime.cc:427]   native: #03 pc 00000000002f1824  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1560)
    art/runtime/runtime.cc:427]   native: #04 pc 00000000002f2e0c  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+124)
    art/runtime/runtime.cc:427]   native: #05 pc 00000000001030b0  /system/lib64/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+156)
    art/runtime/runtime.cc:427]   native: #06 pc 0000000000106764  /system/lib64/libart.so (_ZN3art11ScopedCheck17CheckMethodAndSigERNS_18ScopedObjectAccessEP8_jobjectP7_jclassP10_jmethodIDNS_9Primitive4TypeENS_10InvokeTypeE+1880)
    art/runtime/runtime.cc:427]   native: #07 pc 000000000010525c  /system/lib64/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+740)
    art/runtime/runtime.cc:427]   native: #08 pc 00000000000f71e8  /system/lib64/libart.so (_ZN3art8CheckJNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+96)
    art/runtime/runtime.cc:427]   native: #09 pc 0000000000032568  /data/app/com.ramo.research.firebasendk-1/lib/arm64/libnative-lib.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz+120)
    art/runtime/runtime.cc:427]   native: #10 pc 000000000003b5ac  /data/app/com.ramo.research.firebasendk-1/lib/arm64/libnative-lib.so (_ZN8firebase4util25InitializeActivityClassesEP7_JNIEnvP8_jobject+288)
    art/runtime/runtime.cc:427]   native: #11 pc 000000000003bb9c  /data/app/com.ramo.research.firebasendk-1/lib/arm64/libnative-lib.so (_ZN8firebase4util10InitializeEP7_JNIEnvP8_jobject+84)
    art/runtime/runtime.cc:427]   native: #12 pc 0000000000030a28  /data/app/com.ramo.research.firebasendk-1/lib/arm64/libnative-lib.so (_ZN8firebase3App6CreateERKNS_10AppOptionsEPKcP7_JNIEnvP8_jobject+416)
    art/runtime/runtime.cc:427]   native: #13 pc 000000000002f06c  /data/app/com.ramo.research.firebasendk-1/lib/arm64/libnative-lib.so (_ZN8firebase3App6CreateEP7_JNIEnvP8_jobject+72)
    art/runtime/runtime.cc:427]   native: #14 pc 000000000002eda8  /data/app/com.ramo.research.firebasendk-1/lib/arm64/libnative-lib.so (Java_com_ramo_research_firebasendk_MainActivity_fireBaseTest+64)
    art/runtime/runtime.cc:427]   native: #15 pc 00000000000dc910  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
    art/runtime/runtime.cc:427]   native: #16 pc 00000000000d35e8  /system/lib64/libart.so (art_quick_invoke_static_stub+600)
    art/runtime/runtime.cc:427]   native: #17 pc 00000000000e0030  /system/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+256)
    art/runtime/runtime.cc:427]   native: #18 pc 0000000000291a24  /system/lib64/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+312)
    art/runtime/runtime.cc:427]   native: #19 pc 000000000028aa10  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+596)
    art/runtime/runtime.cc:427]   native: #20 pc 000000000055f648  /system/lib64/libart.so (MterpInvokeStatic+356)
09-01 23:32:37.231 8433-8433/com.ramo.research.firebasendk A/art: art/runtime/runtime.cc:427]   native: #21 pc 00000000000c5e94  /system/lib64/libart.so (ExecuteMterpImpl+14612)
    art/runtime/runtime.cc:427]   at com.ramo.research.firebasendk.MainActivity.fireBaseTest(Native method)
    art/runtime/runtime.cc:427]   at com.ramo.research.firebasendk.MainActivity.onCreate(MainActivity.java:23)
    art/runtime/runtime.cc:427]   at android.app.Activity.performCreate(Activity.java:6974)
    art/runtime/runtime.cc:427]   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    art/runtime/runtime.cc:427]   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2900)
    art/runtime/runtime.cc:427]   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3012)
    art/runtime/runtime.cc:427]   at android.app.ActivityThread.-wrap12(ActivityThread.java:-1)
    art/runtime/runtime.cc:427]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1716)
    art/runtime/runtime.cc:427]   at android.os.Handler.dispatchMessage(Handler.java:110)
    art/runtime/runtime.cc:427]   at android.os.Looper.loop(Looper.java:232)
    art/runtime/runtime.cc:427]   at android.app.ActivityThread.main(ActivityThread.java:6802)
    art/runtime/runtime.cc:427]   at java.lang.reflect.Method.invoke!(Native method)
    art/runtime/runtime.cc:427]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
    art/runtime/runtime.cc:427]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
    art/runtime/runtime.cc:427] 
    art/runtime/runtime.cc:427] 
09-01 23:32:37.232 8433-8433/com.ramo.research.firebasendk A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 8433 (rch.firebasendk)

依存关系设置正确

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.android.gms:play-services-base:15.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'

以及链接的3个依赖项:

libfirebase_app.a
libfirebase_auth.a
libfirebase_database.a

有人可以帮助解决此问题吗? 任何可以解决该问题的技巧和建议,将不胜感激。

0 个答案:

没有答案