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.71k stars 2.22k forks source link

Crashlytics setup documentation results in an app that won't compile #3637

Closed bryansills closed 4 years ago

bryansills commented 4 years ago

Documentation Feedback

I just tried setting up a new app with Crashlytics following the docs here: https://rnfirebase.io/crashlytics/usage That went fine, but once I did the Android specific setup (https://rnfirebase.io/crashlytics/android-setup), my app would not compile. Here is the relevant error:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'nicola'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve io.fabric.tools:gradle:1.28.1.
     Required by:
         project :
      > Could not resolve io.fabric.tools:gradle:1.28.1.
         > Could not get resource 'https://maven.fabric.io/public/io/fabric/tools/gradle/1.28.1/gradle-1.28.1.pom'.
            > Could not GET 'https://maven.fabric.io/public/io/fabric/tools/gradle/1.28.1/gradle-1.28.1.pom'.
               > Connect to maven.fabric.io:443 [maven.fabric.io/0.0.0.0, maven.fabric.io/0:0:0:0:0:0:0:0] failed: Connection refused (Connection refused)

I guess Google shut down the old fabric.io servers sooner than people expected. I did not get around to doing the iOS specific setup, but looking at the official Firebase docs, I'm guessing those are outdated too.

soroushm commented 4 years ago

Same issue

`

Could not resolve all files for configuration ':react-native-firebase_crashlytics:debugCompileClasspath'. Could not find crashlytics-2.10.1.jar (com.crashlytics.sdk.android:crashlytics:2.10.1). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/crashlytics/sdk/android/crashlytics/2.10.1/crashlytics-2.10.1.jar `

Screen Shot 2020-05-10 at 03 08 12
mikehardy commented 4 years ago

I can't reproduce this currently - not saying it didn't happen - just saying it seems to be working fine now. @Salakar this is ominous and makes me curious about #3580 before the hammer drops. Might need to backport to v5 out of user-pity if they're going to turn those servers down

bryansills commented 4 years ago

Nevermind. I'm really dumb. My Pi-hole was blocking fabric.io...🤦‍♂️

mikehardy commented 4 years ago

No worries, I am actually still expecting this to happen at some point and surprise everyone. A little fright might be a good thing then to motivate the switch. Good luck with your project :-)

soroushm commented 4 years ago

for me still have the same issue

mikehardy commented 4 years ago

@soroushm As mentioned, I could not replicate in any combination of my demonstrators. We will need a minimal reproducible demonstration of the problem in order to troubleshoot.

For my part, here is my reproducible demo of RN59+RNFBv5, RN62+RNFBv5 and RN62+RNFBv6, they all work fine, you can clone the repo and try them

https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-rn59.sh

Aure77 commented 4 years ago

I think this is missing in doc on website : https://github.com/invertase/react-native-firebase/blob/master/docs/crashlytics/android-setup.md#1-add-the-fabric-maven-repository

google repo seems not hosting crashlytics. You need to setup an alternate maven repository.

SMJ93 commented 4 years ago

I got this issue when adding

      maven {
            url 'https://maven.fabric.io/public'
      }

To the wrong block 🤦

It should in in buildscript -> repositories and NOT allprojects -> repositories

soroushm commented 4 years ago

@mikehardy Thanks for share the bash I try to set up the demo and get success build on it, then realized in node_module only installed @react-native-firebase/app & app-type (pass the bash end of the file)

already try to clean cache $ rm -rf $HOME/.gradle/caches/ $ ./gradlew cleanBuildCache invalid cache and restart sync grade ....

ERROR: Failed to resolve: crashlytics-2.10.1
Affected Modules: react-native-firebase_crashlytics

react-native info

info Fetching system and libraries information...
System:
    OS: macOS 10.15.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 672.60 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.1 - /usr/local/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.8.4 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 26, 28, 29
      Build Tools: 23.0.1, 23.0.3, 26.0.1, 28.0.3, 29.0.2
      System Images: android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_202-release - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
    }
    repositories {
        maven {
          url 'https://maven.fabric.io/public'
        }
        google()
        jcenter()
    }
    dependencies {
        classpath("com.google.gms:google-services:4.3.3")
        classpath("com.android.tools.build:gradle:3.5.2")
        classpath 'io.fabric.tools:gradle:1.31.1'
        // 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()
        maven { url 'https://www.jitpack.io' }
    }
}

even try with this line like your shell project.ext{set('react-native',[versions:[firebase:[bom:'25.3.1'],],])}

app/build.gradle

apply plugin: "com.android.application"
apply plugin: "io.fabric"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation. If none specified and
 *   // "index.android.js" exists, it will be used. Otherwise "index.js" is
 *   // default. Can be overridden with ENTRY_FILE environment variable.
 *   entryFile: "index.android.js",
 *
 *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    enableHermes: false,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = true

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
android {
    compileSdkVersion rootProject.ext.compileSdkVersion
//     buildToolsVersion rootProject.ext.buildToolsVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    dexOptions {
        javaMaxHeapSize "6g"
    }
    defaultConfig {
        applicationId "com.farabixo"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 130
        versionName "1.3.0"
        multiDexEnabled true
//         renderscriptTargetApi 23
//         renderscriptSupportModeEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
             storeFile file(properties.getProperty('MYAPP_RELEASE_STORE_FILE'))
             storePassword properties.getProperty('MYAPP_RELEASE_STORE_PASSWORD')
             keyAlias properties.getProperty('MYAPP_RELEASE_KEY_ALIAS')
             keyPassword properties.getProperty('MYAPP_RELEASE_KEY_PASSWORD')
        }
        releaseStaging {
             storeFile file(properties.getProperty('MYAPP_RELEASE_STORE_FILE'))
             storePassword properties.getProperty('MYAPP_RELEASE_STORE_PASSWORD')
             keyAlias properties.getProperty('MYAPP_RELEASE_KEY_ALIAS')
             keyPassword properties.getProperty('MYAPP_RELEASE_KEY_PASSWORD')
        }
    }
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            signingConfig signingConfigs.debug
            debuggable true
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
//            useProguard enableProguardInReleaseBuilds
            shrinkResources true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
        releasestaging {
            initWith release
            matchingFallbacks = ['release']
            debuggable true
            applicationIdSuffix ".staging"
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.releaseStaging
            shrinkResources true

        }
    }

    packagingOptions {
        pickFirst "lib/armeabi-v7a/libc++_shared.so"
        pickFirst "lib/arm64-v8a/libc++_shared.so"
        pickFirst "lib/x86/libc++_shared.so"
        pickFirst "lib/x86_64/libc++_shared.so"
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
        releasestagingImplementation files(hermesPath +"hermes-release.aar")

    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
//  com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

bash I tried for demo but look like yarn install not working as well

#!/bin/bash
set -e 

# Basic template create, rnfb install, link
\rm -fr rnfbdemo

echo "Testing react-native current + react-native-firebase v6.current + Firebase SDKs current"
npx react-native init rnfbdemo
cd rnfbdemo

# I have problems in my country with the cocoapods CDN sometimes, use github directly
sed -i -e $'s/def add_flipper_pods/source \'https:\/\/github.com\/CocoaPods\/Specs.git\'\\\n\\\ndef add_flipper_pods/' ios/Podfile
rm -f ios/Podfile.??

# This is the most basic integration
echo "Adding react-native-firebase dependencies"
yarn add "@react-native-firebase/app"

# Perform the minimal edit to integrate it on iOS
echo "Adding initialization code in iOS"
sed -i -e $'s/AppDelegate.h"/AppDelegate.h"\\\n@import Firebase;/' ios/rnfbdemo/AppDelegate.m
rm -f ios/rnfbdemo/AppDelegate.m??
sed -i -e $'s/RCTBridge \*bridge/if ([FIRApp defaultApp] == nil) { [FIRApp configure]; }\\\n  RCTBridge \*bridge/' ios/rnfbdemo/AppDelegate.m
rm -f ios/rnfbdemo/AppDelegate.m??

# Minimal integration on Android is just the JSON, base+core, progaurd
echo "Adding basic java integration"
sed -i -e $'s/dependencies {/dependencies {\\\n        classpath "com.google.gms:google-services:4.3.3"/' android/build.gradle
rm -f android/build.gradle??
echo "apply plugin: 'com.google.gms.google-services'" >> android/app/build.gradle

# Allow explicit SDK version control by specifying our iOS Pods and Android Firebase Bill of Materials
echo "project.ext{set('react-native',[versions:[firebase:[bom:'25.3.1'],],])}" >> android/build.gradle
sed -i -e $'s/  target \'rnfbdemoTests\' do/  $FirebaseSDKVersion = \'6.24.0\'\\\n  target \'rnfbdemoTests\' do/' ios/Podfile
rm -f ios/Podfile??

# Copy the Firebase config files in - you must supply them
echo "Copying in Firebase app definition files"
cp ../GoogleService-Info.plist ios/rnfbdemo/
cp ../google-services.json android/app/

# Copy in a project file that is pre-constructed - no way to patch it cleanly that I've found
# There is already a pre-constructed project file here. 
# Normal users may skip these steps unless you are maintaining this repository and need to generate a new project
# To build it do this:
# 1.  stop this script here (by uncommenting the exit line)
# 2.  open the .xcworkspace created by running the script to this point
# 3.  alter the bundleID to com.rnfbdemo
# 4.  alter the target to 'both' instead of iPhone only
# 5.  "add files to " project and select rnfbdemo/GoogleService-Info.plist for rnfbdemo and rnfbdemo-tvOS
#exit 1
rm -f ios/rnfbdemo.xcodeproj/project.pbxproj
cp ../project.pbxproj ios/rnfbdemo.xcodeproj/

# From this point on we are adding optional modules
# First set up all the modules that need no further config for the demo 
echo "Setting up Analytics, Auth, Database, Dynamic Links, Firestore, Functions, Instance-ID, In App Messaging, Remote Config, Storage"
yarn add \
  @react-native-firebase/analytics \
  @react-native-firebase/auth \
  @react-native-firebase/database \
  @react-native-firebase/dynamic-links \
  @react-native-firebase/firestore \
  @react-native-firebase/functions \
  @react-native-firebase/iid \
  @react-native-firebase/in-app-messaging \
  @react-native-firebase/remote-config \
  @react-native-firebase/storage

# Crashlytics - repo, classpath, plugin, dependency, import, init
echo "Setting up Crashlytics"
yarn add "@react-native-firebase/crashlytics"
sed -i -e $'s/google()/maven { url "https:\/\/maven.fabric.io\/public" }\\\n        google()/' android/build.gradle
rm -f android/build.gradle??
sed -i -e $'s/dependencies {/dependencies {\\\n        classpath "io.fabric.tools:gradle:1.31.2"/' android/build.gradle
rm -f android/build.gradle??
sed -i -e $'s/"com.android.application"/"com.android.application"\\\napply plugin: "io.fabric"\\\ncrashlytics { enableNdk true }/' android/app/build.gradle
rm -f android/app/build.gradle??

# Performance - classpath, plugin, dependency, import, init
echo "Setting up Performance"
yarn add "@react-native-firebase/perf"
rm -f android/app/build.gradle??
sed -i -e $'s/dependencies {/dependencies {\\\n        classpath "com.google.firebase:perf-plugin:1.3.1"/' android/build.gradle
rm -f android/build.gradle??
sed -i -e $'s/"com.android.application" {/"com.android.application"\\\napply plugin: "com.google.firebase.firebase-perf"/' android/app/build.gradle
rm -f android/app/build.gradle??

# I'm not going to demonstrate messaging and notifications. Everyone gets it wrong because it's hard. 
# You've got to read the docs and test *EVERYTHING* one feature at a time.
# But you have to do a *lot* of work in the AndroidManifest.xml, and make sure your MainActivity *is* the launch intent receiver

# I am not going to demonstrate shortcut badging. Shortcut badging on Android is a terrible idea to rely on.
# Only use it if the feature is "nice to have" but you're okay with it being terrible. It's an Android thing, not a react-native-firebase thing.
# (Pixel Launcher won't do it, launchers have to grant permissions, it is vendor specific, Material Design says no, etc etc)

# Set up AdMob
echo "Setting up AdMob"
yarn add "@react-native-firebase/admob"
# Set up an AdMob ID (this is the official "sample id")
printf "{\n  \"react-native\": {\n    \"admob_android_app_id\": \"ca-app-pub-3940256099942544~3347511713\",\n    \"admob_ios_app_id\": \"ca-app-pub-3940256099942544~1458002511\"\n  }\n}" > firebase.json

# Add in the ML Kits and configure them
echo "Setting up ML Vision"
yarn add "@react-native-firebase/ml-vision"
sed -i -e $'s/"react-native": {/"react-native": {\\\n    "ml_vision_face_model": true,/' firebase.json
rm -f firebase.json??
sed -i -e $'s/"react-native": {/"react-native": {\\\n    "ml_vision_ocr_model": true,/' firebase.json
rm -f firebase.json??
sed -i -e $'s/"react-native": {/"react-native": {\\\n    "ml_vision_barcode_model": true,/' firebase.json
rm -f firebase.json??
sed -i -e $'s/"react-native": {/"react-native": {\\\n    "ml_vision_label_model": true,/' firebase.json
rm -f firebase.json??
sed -i -e $'s/"react-native": {/"react-native": {\\\n    "ml_vision_image_label_model": true,/' firebase.json
rm -f firebase.json??

echo "Setting up ML Natural Language"
yarn add "@react-native-firebase/ml-natural-language"
sed -i -e $'s/"react-native": {/"react-native": {\\\n    "ml_natural_language_id_model": true,/' firebase.json
rm -f firebase.json??
sed -i -e $'s/"react-native": {/"react-native": {\\\n    "ml_natural_language_smart_reply_model": true,/' firebase.json
rm -f firebase.json??

# Set the Java application up for multidex (needed for API<21 w/Firebase)
echo "Configuring MultiDex for API<21 support"
sed -i -e $'s/defaultConfig {/defaultConfig {\\\n        multiDexEnabled true/' android/app/build.gradle
rm -f android/app/build.gradle??
sed -i -e $'s/dependencies {/dependencies {\\\n    implementation "androidx.multidex:multidex:2.0.1"/' android/app/build.gradle
rm -f android/app/build.gradle??
sed -i -e $'s/import android.app.Application;/import androidx.multidex.MultiDexApplication;/' android/app/src/main/java/com/rnfbdemo/MainApplication.java
rm -f android/app/src/main/java/com/rnfbdemo/MainApplication.java??
sed -i -e $'s/extends Application/extends MultiDexApplication/' android/app/src/main/java/com/rnfbdemo/MainApplication.java
rm -f android/app/src/main/java/com/rnfbdemo/MainApplication.java??

# Another Java build tweak - or gradle runs out of memory during the build
echo "Increasing memory available to gradle for android java build"
echo "org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" >> android/gradle.properties

# Copy in our demonstrator App.js
rm ./App.js && cp ../AppV6.js ./App.js

# Run the thing for iOS
if [ "$(uname)" == "Darwin" ]; then
  echo "Installing pods and running iOS app"
  cd ios && pod install --repo-update && cd ..
  npx react-native run-ios
  # workaround for poorly setup Android SDK environments
  USER=`whoami`
  echo "sdk.dir=/Users/$USER/Library/Android/sdk" > android/local.properties
fi

# Run it for Android (assumes you have an android emulator running)
echo "Running android app"
npx jetify
cd android && ./gradlew assembleRelease # prove it works
cd ..
# may or may not be commented out, depending on if have an emulator available
# I run it manually in testing when I have one, comment if you like
npx react-native run-android
mikehardy commented 4 years ago

Yeah, so, it works for me @soroushm - I don't know what to say. That was a massive paste salad there and I have no idea what the error message is, because you didn't post any actual error I could see.

It works, my script works, I checked it before posting those links. Proving otherwise requires a posted, reproducible answer in form of github repository I can clone that shows the error (to mirror the work I've done showing conclusively it works...)

Examine everything about your local environment. The problem is there.

soroushm commented 4 years ago

@mikehardy are you sure under node_modules/@react-native-firebase have crashlytics directories on your bash project?

as mention on first post my issue is crashlytics-2.10.1.jar on below link is 404 notfound so the project cant be download and build getting failure


Could not find crashlytics-2.10.1.jar (com.crashlytics.sdk.android:crashlytics:2.10.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/crashlytics/sdk/android/crashlytics/2.10.1/crashlytics-2.10.1.jar```
soroushm commented 4 years ago

can you take a look at this https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android

Salakar commented 4 years ago

FYI; PR #3580 which switches to new Crashlytics SDKS is in ongoing

mikehardy commented 4 years ago

@soroushm I'm not sure what you're hoping to accomplish - I feel like this is wasting both of our time instead of moving your project forward. Let me be completely clear again: it works. I have those directories. It resolves that file. It compiles. It packages. It loads. It runs. There's a problem in your local project as far as I can tell. Yes, we're tracking that closely #3580

soroushm commented 4 years ago

@mikehardy Thank you for your time men I just afraid its somethings depend on network or restrict accessing google I will figure out soon or later :) appreciate your support

Othman2001 commented 1 year ago

@soroushm did you figure out the solution

mikehardy commented 1 year ago

@Othman2001 here is a completely scripted demo script that you can read to understand how to integrate things, it generates a fully working app https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh