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.56k stars 2.19k forks source link

Could not find any version that matches com.google.firebase:firebase-inappmessaging-display:[15.0.0, 16.0.0) #3276

Closed abdullahizzuddiin closed 4 years ago

abdullahizzuddiin commented 4 years ago

Issue

Hello!

I just upgraded react-native version from 0.59.9 to 0.61.5. Along with it, I also upgraded rn-firebase from ver5 to ver6. After I finished installation step that provided https://invertase.io/oss/react-native-firebase/v6/in-app-messaging, I'm ready to start the app. Unfortunately, my build failed.

My issue is similar with https://github.com/invertase/react-native-firebase/issues/2837 but that issue has been closed

Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find any version that matches com.google.firebase:firebase-inappmessaging-display:[15.0.0, 16.0.0).
Versions that do not match:
  - 19.0.3
  - 19.0.2
  - 19.0.1
  - 19.0.0
  - 18.0.2
  - + 11 more
Required by:
    project :app > project :@react-native-firebase_in-app-messaging

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "MYAPPNAME", "version": "0.3.11", "private": true, "scripts": { ... }, "dependencies": { "@react-native-community/async-storage": "^1.7.1", "@react-native-community/netinfo": "^4.1.3", "@react-native-community/push-notification-ios": "^1.0.2", "@react-native-community/viewpager": "^2.0.1", "@react-native-firebase/analytics": "^6.3.4", "@react-native-firebase/app": "^6.3.4", "@react-native-firebase/crashlytics": "^6.3.4", "@react-native-firebase/in-app-messaging": "^6.3.4", "@react-native-firebase/messaging": "^6.3.4", "@react-native-firebase/perf": "^6.3.4", "appcenter": "^3.0.0", "appcenter-analytics": "^3.0.0", "appcenter-crashes": "^3.0.0", "apsl-react-native-button": "^3.1.0", "assert": "^1.4.1", "asyncstorage-down": "^4.0.1", "babel-plugin-transform-remove-console": "^6.8.5", "browserify-zlib": "^0.2.0", "buffer": "^5.1.0", "console-browserify": "^1.1.0", "constants-browserify": "1.0.0", "crypto-js": "^3.1.9-1", "dns.js": "^1.0.1", "domain-browser": "^1.1.7", "events": "^2.0.0", "https-browserify": "1.0.0", "invariant": "^2.2.2", "json-stringify-safe": "^5.0.1", "jssha": "^2.3.1", "jwt-decode": "^2.2.0", "lodash": "^4.17.11", "memoize-one": "^5.1.1", "moment": "^2.15.0", "moment-timezone": "^0.5.11", "os-browserify": "^0.3.0", "path-browserify": "0.0.0", "process": "^0.11.9", "punycode": "^2.1.0", "querystring-es3": "^0.2.1", "react": "16.9.0", "react-native": "0.61.5", "react-native-action-button": "^2.0.6", "react-native-animatable": "^1.2.4", "react-native-check-box": "^2.1.7", "react-native-code-push": "^6.0.0", "react-native-collapsible": "^1.4.0", "react-native-config": "^0.11.7", "react-native-device-info": "^5.3.1", "react-native-emoji": "git+https://github.com/jorilallo/react-native-emoji.git", "react-native-fbsdk": "^1.1.0", "react-native-gesture-handler": "^1.3.0", "react-native-hyperlink": "0.0.14", "react-native-image-picker": "^1.1.0", "react-native-intercom": "14.0.0", "react-native-keyboard-aware-scroll-view": "^0.9.1", "react-native-linear-gradient": "^2.5.4", "react-native-material-dropdown": "^0.11.1", "react-native-modalbox": "^1.7.1", "react-native-onesignal": "git+https://github.com/abdullahizzuddiin/react-native-onesignal.git", "react-native-photo-view": "git+https://github.com/alwx/react-native-photo-view.git", "react-native-reanimated": "^1.7.0", "react-native-root-toast": "^3.2.0", "react-native-router-flux": "^4.1.0-beta.8", "react-native-scrollable-tab-view": "^1.0.0", "react-native-spinkit": "^1.5.0", "react-native-tcp": "^3.3.0", "react-native-udp": "^2.5.0", "react-redux": "^5.0.7", "react-static-container": "^1.0.1", "react-timer-mixin": "^0.13.3", "readable-stream": "^2.3.6", "redux": "^4.0.0", "redux-thunk": "^2.2.0", "rn-fetch-blob": "^0.12.0", "stream-browserify": "^2.0.1", "timers-browserify": "^2.0.10", "tty-browserify": "0.0.1", "url": "^0.11.0", "vm-browserify": "1.0.1", "warning": "^3.0.0" }, "devDependencies": { "@babel/core": "^7.6.2", "@babel/runtime": "^7.6.2", "@react-native-community/eslint-config": "^0.0.5", "babel-jest": "^24.9.0", "eslint": "^6.5.1", "jest": "^24.9.0", "jetifier": "^1.6.3", "metro-react-native-babel-preset": "^0.56.0", "react-devtools": "3.6.2", "react-native-clean-project": "^3.3.0", "react-test-renderer": "16.9.0", "reactotron-react-native": "^2.1.0" }, "react-native": { "zlib": "browserify-zlib", "console": "console-browserify", "constants": "constants-browserify", "crypto": "react-native-crypto", "dns": "dns.js", "net": "react-native-tcp", "domain": "domain-browser", "http": "react-native-http", "https": "https-browserify", "os": "os-browserify", "path": "path-browserify", "querystring": "querystring-es3", "fs": "react-native-level-fs", "_stream_transform": "readable-stream/transform", "_stream_readable": "readable-stream/readable", "_stream_writable": "readable-stream/writable", "_stream_duplex": "readable-stream/duplex", "_stream_passthrough": "readable-stream/passthrough", "dgram": "react-native-udp", "stream": "stream-browserify", "timers": "timers-browserify", "tty": "tty-browserify", "vm": "vm-browserify" }, "browser": { "zlib": "browserify-zlib", "console": "console-browserify", "constants": "constants-browserify", "crypto": "react-native-crypto", "dns": "dns.js", "net": "react-native-tcp", "domain": "domain-browser", "http": "react-native-http", "https": "https-browserify", "os": "os-browserify", "path": "path-browserify", "querystring": "querystring-es3", "fs": "react-native-level-fs", "_stream_transform": "readable-stream/transform", "_stream_readable": "readable-stream/readable", "_stream_writable": "readable-stream/writable", "_stream_duplex": "readable-stream/duplex", "_stream_passthrough": "readable-stream/passthrough", "dgram": "react-native-udp", "stream": "stream-browserify", "timers": "timers-browserify", "tty": "tty-browserify", "vm": "vm-browserify" } } ``` #### `firebase.json` for react-native-firebase v6: I don't have this file.

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # Uncomment the next line to define a global platform for your project platform :ios, '10' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' target 'MYAPPNAME' do # Pods for your project rn_path = '../node_modules/react-native' # pod 'Yoga', path: "#{rn_path}/ReactCommon/yoga/Yoga.podspec" pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for MYAPPNAME pod 'AppCenter/Crashes' pod 'AppCenter/Analytics' pod 'AppCenterReactNativeShared' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' pod 'Fabric' pod 'Intercom' pod 'Crashlytics' pod 'ZendeskSDK', :git => 'https://github.com/zendesk/zendesk_sdk_ios.git', :branch => '3.0.1-swift5.1-GM' pod 'OneSignal', '>= 2.11.2', '< 3.0' # platform :ios, '9.0' pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios' target 'MYAPPNAMETests' do inherit! :search_paths # Pods for testing end use_native_modules! post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'react-native-config' phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) phase.shell_script = "cd ../../"\ " && RNC_ROOT=./node_modules/react-native-config/"\ " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\ " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\ " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby" target.build_phases << phase target.build_phases.move(phase,0) end if target.name == "React" target.remove_from_project end end end end target 'MYAPPNAME-tvOS' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! # Pods for MYAPPNAME-tvOS target 'MYAPPNAME-tvOSTests' do inherit! :search_paths # Pods for testing end end pre_install do |installer| # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289 Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} end target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.11.2', '< 3.0' end ``` #### `AppDelegate.m`: ```objc /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import #import #import "Intercom/intercom.h" #import "RNFirebaseMessaging.h" #import "AppDelegate.h" #import #import #import #import #import #import #import #import #import #import @import ZendeskSDK; @import ZendeskCoreSDK; @import Firebase; @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //enable debug on release mode, disable when release to user or in debug mode //RCTSetLogThreshold(RCTLogLevelInfo - 1); // Intercom [Intercom setApiKey:@"XXX" forAppId:@"XXX"]; // Firebase init [FIRApp configure]; [ZDKZendesk initializeWithAppId: @"xxx"]; [ZDKSupport initializeWithZendesk: [ZDKZendesk instance]]; id userIdentity = [[ZDKObjCAnonymous alloc] initWithName:nil email:nil]; [[ZDKZendesk instance] setIdentity:userIdentity]; [AppCenterReactNativeCrashes registerWithAutomaticProcessing]; // Initialize AppCenter crashes [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; // Initialize AppCenter analytics [AppCenterReactNative register]; // Initialize AppCenter [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"MYAPPNAME" initialProperties:nil]; // Sentry init UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; // Fabric [Fabric with:@[[Crashlytics class]]]; return YES; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] annotation:options[UIApplicationOpenURLOptionsAnnotationKey] ]; return handled; } - (void)applicationDidBecomeActive:(UIApplication *)application{ /* Reset badge app count if so desired */ } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; // Intercom [Intercom setDeviceToken:deviceToken]; } - (void) application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)info{ } // onesignal background notification - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; [self processPaymentInfo: userInfo]; } /* For devices running on ios 10 and above */ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { completionHandler( UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge ); } /* For devices running on ios 10 and above */ - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { completionHandler(); } - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { [RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings]; } // Required for the registrationError event. - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error]; } // Required for the localNotification event. - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { [RNCPushNotificationIOS didReceiveLocalNotification:notification]; } - (void)processPaymentInfo:(NSDictionary *) additionalData { NSLog(@"ON NOTIFICATION PROCESSING"); NSLog(@"%@", additionalData); NSLog(@"Finishing payment transaction"); @try { int fee = [[additionalData valueForKey:@"biaya"] intValue]; int status = [[additionalData valueForKey:@"statusTransaksi"] intValue]; int transactionId = [[additionalData valueForKey:@"idTransaksi"] intValue]; int transactionType = [[additionalData valueForKey:@"jenis_transaksi"] intValue]; if (fee > 0 && status == 2) { [self finishPayment:transactionId withFee:fee]; } else if (fee > 0 && status == 6 && transactionType == 6) { [self refundPayment:transactionId withFee:fee]; } } @catch (NSException* e) { NSLog(@"Payment info exception => %@", e); } } - (void)finishPayment:(int) transactionId withFee:(int) fee { [FIRAnalytics logEventWithName:kFIREventEcommercePurchase parameters:@{ kFIRParameterTransactionID: [NSString stringWithFormat:@"%d", transactionId], kFIRParameterValue: [NSString stringWithFormat:@"%d", fee], kFIRParameterCurrency: @"IDR" }]; } - (void)refundPayment:(int) transactionId withFee:(int) fee { [FIRAnalytics logEventWithName:kFIREventPurchaseRefund parameters:@{ kFIRParameterTransactionID: [NSString stringWithFormat:@"%d", transactionId], kFIRParameterValue: [NSString stringWithFormat:@"%d", fee], kFIRParameterCurrency: @"IDR" }]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [CodePush bundleURL]; #endif } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [x] 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 apply plugin: "com.onesignal.androidsdk.onesignal-gradle-plugin" apply plugin: "com.android.application" apply plugin: "io.fabric" buildscript { repositories { google() maven { url "http://dl.bintray.com/populov/maven" } mavenCentral() maven { url "https://jitpack.io" } maven { url "https://maven.fabric.io/public" } maven { url "https://plugins.gradle.org/m2/"} jcenter() } dependencies { // The Fabric Gradle plugin uses an open ended version to react // quickly to Android tooling updates classpath "io.fabric.tools:gradle:1.31.2" classpath "gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]" } } repositories { google() mavenCentral() maven { url "http://dl.bintray.com/populov/maven" } maven { url "https://maven.google.com" } maven { url "https://jitpack.io" } maven { url "https://maven.fabric.io/public" } maven { url 'https://zendesk.jfrog.io/zendesk/repo' } jcenter() } import com.android.build.OutputFile def getPassword(String currentUser, String keyChain) { def stdout = new ByteArrayOutputStream() def stderr = new ByteArrayOutputStream() exec { commandLine "security", "-q", "find-generic-password", "-a", currentUser, "-s", keyChain, "-w" standardOutput = stdout errorOutput = stderr ignoreExitValue true } //noinspection GroovyAssignabilityCheck stdout.toString().trim() } project.ext.react = [ entryFile: "index.js", enableHermes: false, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" // 2nd line, add a new apply: apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.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 = false /** * 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); def pass = 'K0d0kB4ngk0k' android { flavorDimensions "default" compileSdkVersion 28 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } useLibrary "org.apache.http.legacy" dexOptions { javaMaxHeapSize "4g" jumboMode true } packagingOptions { exclude "META-INF/DEPENDENCIES" exclude "META-INF/NOTICE" exclude "META-INF/LICENSE" } defaultConfig { applicationId "MYAPPNAME" minSdkVersion 21 targetSdkVersion 28 versionCode project.env.get("ANDROID_VERSION_CODE").toInteger() versionName project.env.get("ANDROID_VERSION_NAME") multiDexEnabled true defaultConfig { vectorDrawables.useSupportLibrary = true } testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { release { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword pass keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword pass } } productFlavors { production { applicationId 'MYAPPNAME' resValue "string", "build_config_package", "MYAPPNAME" } staging { applicationId 'MYAPPNAME.staging' resValue "string", "build_config_package", "MYAPPNAME" } freeze { applicationId 'MYAPPNAME.freeze' resValue "string", "build_config_package", "MYAPPNAME" } transition { applicationId 'MYAPPNAME.transition' resValue "string", "build_config_package", "MYAPPNAME" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" signingConfig signingConfigs.release matchingFallbacks = ["release"] } debug { manifestPlaceholders = [onesignal_app_id: "50bbfddc-9772-4eb5-a54f-9bde28e1021f", onesignal_google_project_number: "814079781850"] debuggable true applicationIdSuffix ".debug" //codepush matchingFallbacks = ["debug"] } } // 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 } } variant.outputs.all { output -> def project = "flip" def SEP = "_" def flavor = variant.productFlavors[0].name def buildType = variant.variantData.variantConfiguration.buildType.name def version = variant.versionName def date = new Date(); def formattedDate = date.format('yyyy.MM.dd_HH.mm.ss') def newApkName = project + SEP + buildType + SEP + version + SEP + formattedDate + ".apk" outputFileName = new File(newApkName) } } configurations.all { resolutionStrategy.force "com.google.android.gms:play-services-measurement-base:17.0.0" resolutionStrategy.force "com.google.android.gms:play-services-basement:17.0.0" } } dependencies { if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } implementation "com.facebook.stetho:stetho:1.5.0" implementation fileTree(dir: "libs", include: ["*.jar"]) implementation 'io.intercom.android:intercom-sdk-fcm:5.+' implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.legacy:legacy-support-core-utils:1.0.0' implementation 'com.google.android.material:material:1.0.0' implementation "com.facebook.react:react-native:+" // From node_modules implementation 'androidx.multidex:multidex:2.0.0' implementation "uk.co.chrisjenx:calligraphy:2.1.0" implementation "com.google.android.gms:play-services-location:16.0.0" implementation "me.leolin:ShortcutBadger:1.1.21@aar" implementation ("com.crashlytics.sdk.android:crashlytics:2.9.9@aar"){ transitive = true } implementation group: 'com.zendesk', name: 'support', version: '2.2.1' implementation 'com.google.android.gms:play-services-auth:17.0.0' api("com.google.android.gms:play-services-measurement-sdk-api:17.0.0") { force = true; } implementation("com.google.android.gms:play-services-tasks:17.0.0") implementation 'com.facebook.android:facebook-android-sdk:[5,6)' testImplementation "junit:junit:4.12" } // 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" } //https://github.com/flutter/flutter/issues/19868#issuecomment-408550356 // com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true apply plugin: "com.google.gms.google-services" apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'MYAPPNAME' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' ``` #### `MainApplication.java`: ```java package MYAPPNAME; import android.app.Application; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import io.intercom.android.sdk.Intercom; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import uk.co.chrisjenx.calligraphy. CalligraphyConfig; import com.microsoft.codepush.react.CodePush; import java.lang.reflect.InvocationTargetException; import java.util.List; import android.content.Context; import androidx.multidex.MultiDex; import com.facebook.stetho.Stetho; import com.facebook.soloader.SoLoader; import zendesk.core.Zendesk; import zendesk.core.Identity; import zendesk.core.AnonymousIdentity; import zendesk.support.Support; import com.google.android.gms.security.ProviderInstaller; import javax.net.ssl.SSLContext; import com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); } @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: packages.add(new MyReactPackage()); return packages; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); this.forceUsingNewestTLS(); Intercom.initialize(this, BuildConfig.INTERCOM_API_KEY, BuildConfig.INTERCOM_APP_ID); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this); // Remove this line if you don't want Flipper enabled CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/lato_regular.ttf") .setFontAttrId(R.attr.fontPath) .build()); Stetho.initializeWithDefaults(this); Support.INSTANCE.init(Zendesk.INSTANCE); Identity identity = new AnonymousIdentity(); Zendesk.INSTANCE.setIdentity(identity); Fabric.with(this, new Crashlytics()); } /** * Loads Flipper in React Native templates. * * @param context */ private static void initializeFlipper(Context context) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } //@Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } private void forceUsingNewestTLS(){ try { ProviderInstaller.installIfNeeded(getApplicationContext()); SSLContext sslContext; sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, null, null); sslContext.createSSLEngine(); } catch (Exception e) { e.printStackTrace(); } } } ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 10.15.2 CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz Memory: 302.38 MB / 8.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.5.0 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.13.4 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 IDEs: Android Studio: 3.5 AI-191.8026.42.35.6010548 Xcode: 11.1/11A1027 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [x] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 6.3.4` - **`Firebase` module(s) you're using that has the issue:** - analytics: v6.3.4, - app: v6.3.4, - crashlytics: v6.3.4, - in-app-messaging: v6.3.4, - messaging: v6.3.4, - perf: v6.3.4, - **Are you using `TypeScript`?** - `N`


Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

mikehardy commented 4 years ago

How did it go when you used gradle to see what was pulling in which version of that dependency, leading to the conflict? https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html

abdullahizzuddiin commented 4 years ago

Hello, @mikehardy thanks for your response.

I tried to make list of app dependencies using ./gradlew app:dependencies and also tried to build my app with --scan on ./gradlew paramaters, both of them gave failed result.

I don't know why, the error result is Problems reading data from Binary store in /private/var/folders/pw/5mcw3bzs24z6vppytb1mdyb40000gn/T/gradle5927094399864797415.bin offset 452323 exists? true

I've followed on this thread suggestion by increasing gradle version, but my build still failed.

this error only happened when I added "@react-native-firebase/in-app-messaging" on my project. When I deleted those package and I only have

"@react-native-firebase/analytics": "^6.3.4",
    "@react-native-firebase/app": "^6.3.4",
    "@react-native-firebase/crashlytics": "^6.3.4",
    "@react-native-firebase/messaging": "^6.3.4",
    "@react-native-firebase/perf": "^6.3.4",

my build is successful.

panncr commented 4 years ago

I wonder how to solve this problem too. Because I also faced this problem.

mikehardy commented 4 years ago

If ./gradlew app:dependencies fails, there is a serious problem with your local project, that command should work. You might try ./gradlew clean first or similar

abdullahizzuddiin commented 4 years ago

Sincerely, I have tried to clean my gradle then ran app:dependencies or build before I posted.

But, it still gave same result

* What went wrong:
Execution failed for task ':app:dependencies'.
> Could not resolve all dependencies for configuration ':app:freezeDebugRuntimeClasspath'.
   > Problems reading data from Binary store in /private/var/folders/pw/5mcw3bzs24z6vppytb1mdyb40000gn/T/gradle11386364091753847451.bin offset 496 exists? true

It only happened after I added @react-native-firebase/in-app-messaging.

I also tried to create new project with added only firebase packages that I needed

"@react-native-firebase/in-app-messaging",
"@react-native-firebase/analytics": "^6.3.4",
    "@react-native-firebase/app": "^6.3.4",
    "@react-native-firebase/crashlytics": "^6.3.4",
    "@react-native-firebase/messaging": "^6.3.4",
    "@react-native-firebase/perf": "^6.3.4",

my build is successful (actually, i deleted crashlytics because it give error about crashlytics ID that is not mentioned in docs).

abdullahizzuddiin commented 4 years ago

Hi @mikehardy

I got this when I ran app:dependencies with --stacktrace

Caused by: java.lang.RuntimeException: Problems reading data from Binary store in /private/var/folders/pw/5mcw3bzs24z6vppytb1mdyb40000gn/T/gradle9669641901155168042.bin offset 12898 exists? true
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:132)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.lambda$create$0(StreamingResolutionResultBuilder.java:187)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory$SimpleStore.load(CachedStoreFactory.java:101)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:185)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:157)
        at org.gradle.api.internal.artifacts.result.DefaultResolutionResult.getRoot(DefaultResolutionResult.java:47)
        at org.gradle.api.internal.artifacts.result.DefaultResolutionResult.getAllComponents(DefaultResolutionResult.java:85)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolutionResult.getAllComponents(ErrorHandlingConfigurationResolver.java:229)
        ... 171 more
Caused by: java.lang.IllegalStateException: Corrupt serialized resolution result. Cannot find selected module (464) for constraint platform-runtime -> com.google.firebase:firebase-inappmessaging-display:19.0.2
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.DefaultResolutionResultBuilder.visitOutgoingEdges(DefaultResolutionResultBuilder.java:82)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.deserialize(StreamingResolutionResultBuilder.java:237)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:130)
        ... 178 more

Something weird on Caused by: java.lang.IllegalStateException: Corrupt serialized resolution result. Cannot find selected module (464) for constraint platform-runtime -> com.google.firebase:firebase-inappmessaging-display:19.0.2

for this time I remove all rn-firebase packages except app and in-app-messaging

abdullahizzuddiin commented 4 years ago

For anyone who curious what i've done after this errors,

I replaced rn-firebase/in-app-messaging to native firebase/in-app-messaging.

No error occured

MujtabaFR commented 4 years ago

I just migrated from rn-firebase v5 to v6 and I had this same issue, couldn't understand the cause..

The real version I have installed is com.google.firebase:firebase-inappmessaging-display:19.0.4 but android is tying to load com.google.firebase:firebase-inappmessaging-display:[15.0.0, 16.0.0)

I don't know where this [15.0.0, 16.0.0) came from

my temporary solution was to batch* the file node_modules/@react-native-firebase/in-app-messaging/android/build.gradle and add a version on line 73 :

implementation "com.google.firebase:firebase-inappmessaging-display:latest.release"

* Batching using patch-package

mikehardy commented 4 years ago

@MujtabaFR that's not great advice even if it works for you. You should analyze your dependencies to discover where it's coming from: ./gradlew app:dependencies And if you want to control react-native-firebase to pin specific versions you should use the provided variable like so: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh#L32

kahakai commented 3 years ago

I had the same error after migrating from v5 to v6, but with firebase-crashlytics. I'm also using OneSignal in the project and it appeared that they had an issue in their Gradle plugin for Android, however the error in the build log was pointing to :@react-native-firebase_crashlytics. Upgrading the OneSignal Gradle plugin fixed the original issue for me. You can look for the details here: Issue in OneSignal Gradle Plugin repository

zabojad commented 3 years ago

This issue started has just to pop in my project:

* What went wrong:
Execution failed for task ':app:dependencies'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
   > Problems reading data from Binary store in /private/var/folders/mc/2kyt0cbn12d95zcg5wzb0sj80000gn/T/gradle677515011674002555.bin offset 514 exists? true

I tried to update

"@react-native-firebase/analytics": "10.4.1",
"@react-native-firebase/app": "10.4.0",

to:

    "@react-native-firebase/analytics": "11.4.1",
    "@react-native-firebase/app": "11.4.1",

but I'm still having this problem...

/gradlew clean does not help neither...

Anyone any idea?

zabojad commented 3 years ago

I'm also using the react-native-push-notification module in my project and the setup of that module says this:

In android/app/build.gradle

dependencies { ... implementation 'com.google.firebase:firebase-analytics:17.3.0' ... }

apply plugin: 'com.google.gms.google-services' Then put your google-services.json in android/app/.

I've commented it and it passes this error... Anyone could explain me why and if I did the right thing?

mikehardy commented 3 years ago

@zabojad --> #5293 may be more on topic for you today? It's quite recent