0

From my C code in the Android NDK app, I'm trying to initialize Crashlytics but it's returning NULL.

LOGW ("Initializing Crashlytics");
crashlyticsContext = crashlytics_init();
LOGI ("crashlyticsContext: %lx", (uint32_t) crashlyticsContext);

In the logcat log, I'm getting a Permission Denial log:

W/SimTalk: Initializing Crashlytics
W/ActivityManager: Permission Denial: getCurrentUser() from pid=18043, uid=10079 requires android.permission.INTERACT_ACROSS_USERS
I/SimTalk: crashlyticsContext: 0

My build.gradle file includes the compile line for the NDK:

compile('com.crashlytics.sdk.android:crashlytics-ndk:2.0.2@aar') {
    transitive = true
}

and the crashlytics section

crashlytics {
    enableNdk true
}

and my AndroidManifest.xml file does contain my metadata:

<meta-data
    android:name="io.fabric.ApiKey"
    android:value="............omitted.............." />

Do you have any idea why my crashlytics_init() isn't working?

Update: I've determined that the dlopen() call in crashlytics_init() is returning NULL. The libcrashlytics.so file is included in the APK along with the other libs. It's still not loading, though.

David Buck
  • 2,847
  • 15
  • 16
  • The log is quite clear. `requires android.permission.INTERACT_ACROSS_USERS` Do you have that permission in your manifest file? – Retired Ninja Mar 10 '18 at 18:29
  • I tried it and it didn't work. I'm starting to suspect that it's a random log that happens on my tablet even when I'm not running my app. – David Buck Mar 10 '18 at 19:15
  • After more debugging, I've found that the libcrashlytics.so library couldn't be found unless I provided the full path to the library. After doing that, the library loaded fine but sym_ini returns NULL. This is the same problem as https://stackoverflow.com/questions/47211657/crashlytics-ndk-fails-to-load – David Buck Mar 11 '18 at 01:39

0 Answers0