Closed Acetyld closed 3 years ago
You have problems here with flavors, with analytics with flavors.
I use flavors and they work, so I assert the module works fine with flavors
You have redacted your project files sufficiently that I can't determine what is wrong with them, but the burden of proof will be on you to demonstrate flavors failing in a way that is reproducible since it works for me - meaning it should work and we need strong proof. Please post a reproduction on github
I may have the same issue, update from app crashlytics from v7 to v8, trying to enable sym upload, and build fail very early in the build process:
> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Crashlytics could not find NDK build tasks on which to depend. You many need to manually enforce task dependencies for generateCrashlyticsSymbolFileRelease
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> org.gradle.api.GradleException: Crashlytics could not determine stripped/unstripped native library directories for project ':app', variant Release. These are required for generating symbol files when NDK build tasks cannot be automatically inferred. Please specify strippedNativeLibsDir and unstrippedNativeLibsDir in the firebaseCrashlytics extension.
I can confirm that I don't have any specific flavor except debug & release, and have removed the splits.abi
config and custom versionCode(s). RNF Dependency are all up to date.
What happens when you try https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh ? That one does an assembleRelease (which should involve library stripping) and appears to work correctly? https://github.com/mikehardy/rnfbdemo/blob/9e80bacc9b62961f89246eea82dd956f4f8660f8/make-demo.sh#L219 (it even does the ABI splits to verify them, just in case: https://github.com/mikehardy/rnfbdemo/blob/9e80bacc9b62961f89246eea82dd956f4f8660f8/make-demo.sh#L209-L215)
I can reproduce this following your guide (thanks you, saved me a lot of time!) Demo : https://github.com/HugoGresse/rnfirebase-crashlytics-ndk
Step to reproduce:
./gradlew clean
or build
which will output the below errorrnfbdemo/android on î master
â ./gradlew build
> Configure project :app
Crashlytics could not find NDK build tasks on which to depend. You many need to manually enforce task dependencies for generateCrashlyticsSymbolFileRelease
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> org.gradle.api.GradleException: Crashlytics could not determine stripped/unstripped native library directories for project ':app', variant Release. These are required for generating symbol files when NDK build tasks cannot be automatically inferred. Please specify strippedNativeLibsDir and unstrippedNativeLibsDir in the firebaseCrashlytics extension.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
Edit: perf and analytics has no impact
Do you have any NDK installed? :thinking: it may require at least one
React native have ndk inside. The RNF doc say that it should report Yoga error : https://rnfirebase.io/crashlytics/android-setup#4-optional-enable-crashlytics-ndk-reporting
Ah, interesting. I think what's missing is that my make-demo.sh script (which already has firebase and crashlytics) doesn't enable the optional ndk reporting for crashlytics. That's not the default and I was sticking with the default but this is a good area to probe.
Unfortunately I think there is work that we do not document, that you have to do to get it to function: https://firebase.google.com/docs/crashlytics/ndk-reports
You'll need to add the entries for the libraries you care about https://firebase.google.com/docs/crashlytics/ndk-reports#upload-external-dependencies
This could be better documented for sure, and I'm not sure where you can get the unstripped libraries for ReactNative.
Update
Removing the firebaseCrashlytics { nativeSymbolUploadEnabled true }
part fixed the crash.
Now i got the app runing and simulating a crash but
Is stuck on this (BTW we fixed the analytics/firebase connection that is now working fine see other post) but crashlytics wont connect
Honestly that looks like it's working? Sometimes the crash report takes a while to deliver but android crashlytics works pretty well/reliably (modulo the ndk crash reporting, which is hard because it wants stripped and unstripped library locations configured in the gradle files, and do you have those for your external libs? I don't...)
Either way, turn on debug logging to get more info: https://firebase.google.com/docs/crashlytics/test-implementation?platform=android#enable_debug_logging
I had this problem and was able to fix it. I had forgot to add the crashlytics-ndk
to my dependencies in the app level gradle. As per the docs, if you want to enable NDK crash reports:
dependencies {
// ...
// Add the Crashlytics NDK dependency (if you have the
// Firebase Crashlytics dependency, replace it)
implementation 'com.google.firebase:firebase-crashlytics-ndk:17.2.1'
}
See here
@dansiemens strangely though, it is supposed to be imported :thinking: Perhaps it is not okay for it to be imported by a module?
@mikehardy Oops ðĪĶðŧââïļ Didn't realize I had saved previous changes, turns out it was the change by @Acetyld that fixed it
Same issue
@RodolfoGS with same workaround, how'd it go when you used it?
@mikehardy I'm using Expo Bare workflow and I followed the react-native-firebase
docs to install.
I'm experimenting the same issue (Crashlytics could not determine stripped/unstripped native library
) when I enable nativeSymbolUploadEnabled true
I fixed it removing the nativeSymbolUploadEnabled
flag and I'll try to create a new clean project to know if the bug is related with another of the libraries that I have.
@mikehardy steps to reproduce:
expo init ExpoBareCrashlytics
cd ExpoBareCrashlytics
npm install --save @react-native-firebase/app @react-native-firebase/crashlytics
google-services.json
file into android/app
foldergoogle-services
config (https://rnfirebase.io/#configure-firebase-with-android-credentials)nativeSymbolUploadEnabled
config (https://rnfirebase.io/crashlytics/android-setup#4-optional-enable-crashlytics-ndk-reporting)Sync Now
gradle filesCrashlytics could not determine stripped/unstripped
Crashlytics could not determine stripped/unstripped native library directories for project ':app', variant Release. These are required for generating symbol files when NDK build tasks cannot be automatically inferred. Please specify strippedNativeLibsDir and unstrippedNativeLibsDir in the firebaseCrashlytics extension.
That's expected, "Please specify strippedNativeLibsDir and unstrippedNativeLibsDir"
You need to specify the location of the native libs (stripped and unstripped) if you want to use that setting
It's a bit involved, do you have the stripped and unstripped react-native libs? Or the libs for the native libraries that your project is specifically relying on that you want native traces for? You'll need to get them - it's out of scope for this module, though if you got it to work you could share the gradle snippet here.
The only thing you get with this feature is better stacks from the native libraries. Do you definitely need this?
Thanks for your response, I'm testing with a new Expo Bare project, without another libraries installed (only Expo). I think that the best way for me is disable this functionality for now.
Not sure if it is suitable for everyone but with my team with spotted that if in this step : https://rnfirebase.io/crashlytics/android-setup#2-add-the-firebase-crashlytics-plugin-dependency
we use a dependency to 2.0.0
instead of 2.2.0
the build succeed ð
// ..
buildscript {
// ..
dependencies {
// ..
- classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
+ classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0'
}
// ..
}
Based on the changelog @Ladonasc it is just because they augmented that area https://firebase.google.com/support/release-notes/android#crashlytics_gradle_plugin_v2-2-0 - I'm guessing 2.1.0 would "work" as well, but would it really be doing what you think (correctly uploading native NDK-built symbols)? Also a note that the plugin is on 2.3.0 now
Not sure if it is suitable for everyone but with my team with spotted that if in this step : https://rnfirebase.io/crashlytics/android-setup#2-add-the-firebase-crashlytics-plugin-dependency
we use a dependency to
2.0.0
instead of2.2.0
the build succeed ð// .. buildscript { // .. dependencies { // .. - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0' } // .. }
It's true! I tested on 2.0.0 and works perfect. I tested on all versions, the most recent version that works is 2.1.1.
Greatest than 2.2.0 (included) have the stripped/unstripped
error, including 2.3.0 that is the latest version today.
Good stuff @Ladonasc was staring at this for a while too :)
Unfortunately as @mikehardy mention this work only due to an unfixed bug in 2.0.0, I've not checked yet if native NDK-built symbols are properly uploaded (not really fluent with all "native" part of react native ðĪŠ)
Have the same issue +1
@aliceathens I think this is a project specific issue, it appears to work if you can meet the configuration requirements, listed above, how did it go when you correctly specified the stripped and unstripped native library directories?
Just comment this while debugging from app/build.gradle, it's crashing on debugging mode.
firebaseCrashlytics { nativeSymbolUploadEnabled true }
Does anybody know where react-native puts native debug symbols during build? I can't find any information about this so I don't know what an appropriate value for strippedNativeLibsDir
or unstrippedNativeLibsDir
might be.
My most frequent crash in crashlytics is just "libc unknown" because I haven't been able to figure out how to get debug symbols into crashlytics for react-native 0.63.2. The RN gradle scripts must be putting stripped/unstripped libraries somewhere right?
Or maybe there's a way to prevent them from being stripped at all? I tried doNotStrip **.so
in packagingOptions
but that didn't seem to do anything.
Unfortunately I've been able to find very little information about android native debug symbols in react native. Without deep familiarity with the Android build system I don't think I can do much here. In older RNFirebase (v5) I seem to remember getting at least a little more info on native crashes compared to just "unknown" that I get now in crashlytics.
I understand this is frustrating but hopefully you all understand that this is not really a react-native-firebase issue - crashlytics (we are just wrapping) doesn't know about react-native so doesn't do anything special, and react-native doesn't know you need unstripped libraries later so it packages optimized things (which you would normally want).
I think the only way to do this is to build your own react-native from source, with some alterations in it's build system to maintain the unstripped libraries you need, before packaging. From what I understand the libraries react-native relies on are all stripped before they are put into the .aar file for consumption by react-native projects
Building react-native from source is not as hard as it sounds, the documents which explain how to do so work in my experience but it's been a while since I have done it. I definitely recommend only using a stable branch of react-native to do so, but it's a reasonable thing to contemplate doing.
Thanks for the clarification @mikehardy. I have built RN from source and you're right, it's not very difficult.
Figuring out how to get the debug symbols output in a usable manner was an issue I never managed to fully solve however.
There's unfortunately very little information available and gradle seems quite... brittle. Seemingly inconsequential changes like a minor version bump of android gradle plugin or other dependency version seem to frequently cause difficult cryptic errors. Tracking all the moving parts there is quite difficult without significant native Android experience and deep knowledge of the android native deps of every plugin in your RN project.
I'm going to have to give it another try since we have ~5% of end user sessions crashing on Android with just libc unknown
. I'll update here if I manage to find a usable configuration with native debug symbols uploaded to crashlytics and/or play store.
https://stackoverflow.com/questions/42981553/how-to-get-unstripped-so-from-externalnativebuild-and-cmake-with-gradle has some (old! but maybe useful) pointers to directories for pre-stripped libs
This is where the native compile of 1st party modules at least happens: https://github.com/facebook/react-native/blob/71bb19827b0568ead70dc5c591d07ec976445449/ReactAndroid/build.gradle#L305
Note that even if you get all this working - it could happen, hopefully not but could happen - the crashes may actually be in a 3rd party module that the build simply depends on, meaning you'd have to go one link down the chain even to get unstripped libraries for it.
Hopefully it's not a rabbit hole like that though - this looks like a tough job to do correctly but obviously the payoff in fixing crashes will be nice if there are enough of them...good luck!
Hello ð, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.
Not a resolution on this one exactly - but if you check the https://firebase.google.com/support/release-notes/android release notes for the crashlytics plugin, it looks like upstream is moving away from this directive completely.
Update
Removing the
firebaseCrashlytics { nativeSymbolUploadEnabled true }
part fixed the crash.Now i got the app runing and simulating a crash but
Is stuck on this (BTW we fixed the analytics/firebase connection that is now working fine see other post) but crashlytics wont connect
Thanks, it worked for me.
@AndrewMorsillo I'm trying to do the same thing
https://stackoverflow.com/a/55547400/433570 There's a unstripped symbol files.
Not sure if it is suitable for everyone but with my team with spotted that if in this step : https://rnfirebase.io/crashlytics/android-setup#2-add-the-firebase-crashlytics-plugin-dependency we use a dependency to
2.0.0
instead of2.2.0
the build succeed ð// .. buildscript { // .. dependencies { // .. - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0' } // .. }
It's true! I tested on 2.0.0 and works perfect. I tested on all versions, the most recent version that works is 2.1.1. Greatest than 2.2.0 (included) have the
stripped/unstripped
error, including 2.3.0 that is the latest version today.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
Worked for me
Please note "worked" is, "fails, but they were not checking for failures like that in older versions", and in even more current versions I think they have removed this functionality? So I would say you are successfully building now, which is definitely a definition of "worked" but I would not exactly say it is "working as expected" based on my understanding of this problem. Unfortunately it is difficult to get the libraries set up for this based on how react-native does builds
Here's a better approach that works with newer versions of firebase-crashlytics-gradle!
release {
// ...
firebaseCrashlytics {
nativeSymbolUploadEnabled true
strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib'
unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
}
// ...
}
Here's a better approach that works with newer versions of firebase-crashlytics-gradle!
release { // ... firebaseCrashlytics { nativeSymbolUploadEnabled true strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib' unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib' } // ... }
https://firebase.google.com/docs/crashlytics/ndk-reports#update-gradle-config for more details
Here's a better approach that works with newer versions of firebase-crashlytics-gradle!
release { // ... firebaseCrashlytics { nativeSymbolUploadEnabled true strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib' unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib' } // ... }
Looks like strippedNativeLibsDir
is deprecated and no longer in use.
It worked with just unstrippedNativeLibsDir
ðŊ
Thanks for the success reports here @germanp173 @elbourki - I just updated the documents and our test app in #5477 to reflect the current style :+1:
Old and closed issue, but its still seems to be in the same state. The official guide does not mention this unstrippedNativeLibsDir
option and what I found is that it really supresses the error, but I'm not sure if its doing anything. Try to change the path to anything arbitrary and the build will still pass without any error/notice.
When using android flavors, then it becomes more complicated as the release
dir in the example is the build variant's name which is eg. normalRelease
when using a flavor named normal
. Configuring unstrippedNativeLibsDir
per build variant is not really possible, as explained here: https://github.com/firebase/firebase-android-sdk/issues/1684
Anyone investigated this topic deeper? Looks like it only worth to enable this optional nativeSymbolUploadEnabled
for basic flavorless projects.
Issue
Crashlytics is giving a error on build of any variant (we are using flavors).
Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "soundboard_app", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "androidcringe": "react-native run-android --variant \"cringeSoundboardDebug\" --appIdSuffix \"cringesoundboard\"", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-community/async-storage": "^1.12.0", "@react-native-community/eslint-plugin": "^1.1.0", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/netinfo": "^5.9.6", "@react-native-firebase/admob": "^7.6.3", "@react-native-firebase/analytics": "^7.6.2", "@react-native-firebase/app": "^8.4.2", "@react-native-firebase/auth": "^9.2.2", "@react-native-firebase/crashlytics": "^8.4.4", "@react-native-firebase/firestore": "^7.8.1", "@react-navigation/drawer": "^5.9.0", "@react-navigation/native": "^5.7.3", "@react-navigation/stack": "^5.9.0", "@reduxjs/toolkit": "^1.4.0", "axios": "^0.20.0", "eslint-config-prettier": "^6.11.0", "i18next": "^19.7.0", "moment": "^2.27.0", "patch-package": "^6.2.2", "prop-types": "^15.7.2", "react": "16.13.1", "react-hook-form": "^6.8.1", "react-i18next": "^11.7.2", "react-native": "0.63.2", "react-native-bootsplash": "^2.2.5", "react-native-device-info": "^6.0.2", "react-native-error-boundary": "^1.1.2", "react-native-fast-toast": "^1.0.6", "react-native-gesture-handler": "^1.8.0", "react-native-iap": "^4.5.3", "react-native-keyboard-aware-scroll-view": "^0.9.2", "react-native-reanimated": "^1.13.0", "react-native-safe-area-context": "^3.1.7", "react-native-screens": "^2.10.1", "react-native-sound": "^0.11.0", "react-native-svg": "^12.1.0", "react-native-swipe-gestures": "^1.0.5", "react-native-tiny-toast": "^1.0.7", "react-native-webview": "^10.8.3", "react-redux": "^7.2.1", "recyclerlistview": "^3.0.0", "redux": "^4.0.5", "rn-fetch-blob": "^0.12.0" }, "devDependencies": { "@babel/core": "^7.8.4", "@babel/runtime": "^7.8.4", "@react-native-community/eslint-config": "^1.1.0", "@types/node": "^14.10.1", "babel-jest": "^25.1.0", "eslint": "^6.5.1", "jest": "^25.1.0", "metro-react-native-babel-preset": "^0.59.0", "react-test-renderer": "16.13.1" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```
Android
Click To Expand
#### Have you converted to AndroidX? #### Have you converted to AndroidX? - [ x] my application is an AndroidX application? - [ x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ x] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ``` buildscript { ext { buildToolsVersion = "29.0.2" minSdkVersion = 16 compileSdkVersion = 29 targetSdkVersion = 29 // Put here other AndroidX dependencies } repositories { google() jcenter() } dependencies { classpath "com.google.firebase:firebase-crashlytics-gradle:2.2.0" classpath "com.google.gms:google-services:4.3.3" classpath("com.android.tools.build:gradle:3.5.3") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } google() jcenter() } } project.ext{set('react-native',[versions:[firebase:[bom:'25.7.0'],],])} ``` #### `android/app/build.gradle`: ``` apply plugin: "com.android.application" apply plugin: 'com.google.gms.google-services' // <- Add this line apply plugin: 'com.google.firebase.crashlytics' project.ext.react = [ enableHermes: false, // clean and rebuild if changing ] def enableHermes = project.ext.react.get("enableHermes", false); **BUILDTYPES:** buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://facebook.github.io/react-native/docs/signed-apk-android. minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" firebaseCrashlytics { nativeSymbolUploadEnabled true } } } ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: Windows 10 10.0.19041 CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor Memory: 13.95 GB / 31.94 GB Binaries: Node: 14.5.0 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels: 23, 28, 29, 30 Build Tools: 28.0.3, 29.0.2, 30.0.0 System Images: android-28 | Google Play Intel x86 Atom Android NDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Version 4.0.0.0 AI-193.6911.18.40.6514223 Visual Studio: Not Found Languages: Java: Not Found Python: Not Found npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.2 => 0.63.2 react-native-windows: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `newest` - **`Firebase` module(s) you're using that has the issue:** - `Analytics` - **Are you using `TypeScript`?** - `N`
React Native Firebase
andInvertase
on Twitter for updates on the library.