invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.7k stars 2.21k forks source link

[🐛][Android] Could not find method firebaseCrashlytics() #4314

Closed aprilmintacpineda closed 4 years ago

aprilmintacpineda commented 4 years ago

Issue

Describe your issue here

I was setting up react-native-firebase on a bare react-native app and I followed the optional step here https://rnfirebase.io/crashlytics/android-setup#4-optional-enable-crashlytics-ndk-reporting but I got this error when I do react-native android

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method firebaseCrashlytics() for arguments [build_eb1e26l7v1ub3obnwzg5vs7s$_run_closure1$_closure8$_closure14$_closure15@48eabe2f] on BuildType_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={react_native_dev_server_port=com.android.builder.internal.ClassFieldImpl@99240943, react_native_inspector_proxy_port=com.android.builder.internal.ClassFieldImpl@44d408ec}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType.

Project Files

Javascript

Click To Expand

#### `package.json`: ```json # N/A ``` #### `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? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` OUTPUT GOES HERE ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] 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:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`


mikehardy commented 4 years ago

You're missing all the requested information from the templates. Can you try building a reproducible example starting from https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh and posting it?

FadiAboMsalam commented 4 years ago

I am also facing this issue any fix for this @mikehardy @aprilmintacpineda

mikehardy commented 4 years ago

@FadiAboMsalam no, because the original reporter provided insufficient information.

seyedasfar commented 4 years ago

skipping 4th step solves the issue.

mikehardy commented 4 years ago

@usama-asfar does not "solve" the issue, "works around incorrect (but optional) NDK crash reporting" is more correct - if you need NDK crash reporting, you need that step, then you may still have this issue if you don't get the config just right.

Precision in troubleshooting is vital, especially if chiming in on other people's issues

aprilmintacpineda commented 4 years ago

That step is optional, this library still works even without that step, you only do it when you want to catch NDK related crashes. I will try to provide a repo for repro, sorry for being unable to do that, my time is all consumed by work-related tasks :(

mikehardy commented 4 years ago

@aprilmintacpineda I think there is actually another issue in the list that is a little farther along where someone really wants to get the NDK reporting working and is trying to do a build of react-native locally in order to play with the settings for stripped / unstripped directories. That would really advance the state of the art here. That you will get this error just by configuring NDK crash reporting but not providing the directories is a known thing and is correct behavior, simply reproducing it won't move it forward

zhangjianshuai commented 3 years ago

@mikehardy i am also facing this issuse, used unity 2017.4.31f1, build with il2cpp and mainTemplate, firebase sdk for unity6.16.1;
cannot build success when using :

` implementation 'com.google.firebase:firebase-crashlytics-ndk:17.2.2'`

signingConfigs {
        release {
......
            // Add this extension
              firebaseCrashlytics {
                  nativeSymbolUploadEnabled true
              }
.....
        }
    }

, could you help me ,and the building errorlog :

`

* Where:
Build file '/Users/jens/Documents/AMS/DevBranch/Client/Game/Temp/gradleOut/build.gradle' line: 187

* What went wrong:
A problem occurred evaluating root project 'gradleOut'.
> Could not find method firebaseCrashlytics() for arguments [build_4630dycsspsb9cr5ti5hn2v7z$_run_closure7$_closure23$_closure28$_closure29@37d602e6] on SigningConfig_Decorated{name=release, storeFile=null, storePassword=null, keyAlias=null, keyPassword=null, storeType=null, v1SigningEnabled=true, v2SigningEnabled=true} of type com.android.build.gradle.internal.dsl.SigningConfig.

`

or

* What went wrong:

A problem occurred evaluating root project 'gradleOut'.
> Failed to apply plugin [id 'com.google.firebase.crashlytics']
   > Could not create plugin of type 'CrashlyticsPlugin'.
      > org/gradle/api/tasks/TaskProvider

Waiting for your reply, thanking you;;;

mikehardy commented 3 years ago

There is no way I will be able to help without a minimal reproduction posted on a github URL My best advice is to stop using the native symbol upload feature though

dmitryzaytsev commented 3 years ago

Same here. Just went through the tutorial and when trying to add NDK it will fail:

    buildTypes {
        release {
           // .... does not work
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
            }
        }
    }

Versions:

        classpath('com.android.tools.build:gradle:3.6.3')
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
    "@react-native-firebase/app": "^10.5.0",
    "@react-native-firebase/crashlytics": "^10.5.1",
    "@react-native-firebase/messaging": "^10.5.1",
bpander commented 3 years ago

@aprilmintacpineda @dmitryzaytsev @FadiAboMsalam @zhangjianshuai Not sure if it'll help, but I also ran into this error when I tried enabling NDK reporting. My apply lines were at the bottom of my android/app/build.gradle file. I moved them to the top of the file and the error went away.

leni8ec commented 3 years ago

Update gradle wrapper to version 5.6.4 (from 5.4.1) - solved my problem with this error.

file: gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

My Android Build Gradle tools is 3.5.4 com.android.tools.build:gradle:3.5.4

molimat commented 3 years ago

@aprilmintacpineda @dmitryzaytsev @FadiAboMsalam @zhangjianshuai Not sure if it'll help, but I also ran into this error when I tried enabling NDK reporting. My apply lines were at the bottom of my android/app/build.gradle file. I moved them to the top of the file and the error went away.

this does work.

fontesrp commented 2 years ago

@bpander 's answer worked for me as well. Thanks!

mikehardy commented 2 years ago

This had me worried so I just double-checked:

https://rnfirebase.io/crashlytics/android-setup#3-apply-the-firebase-crashlytics-plugin-to-your-app

Apply the com.google.firebase.crashlytics plugin by adding the following to the top of your android/app/build.gradle file:

This is as documented, so if having it at the top works (and it sounds like it does, the success reports are nice), excellent :-)