Closed noway closed 1 year ago
I am experiencing the same issue..
I have the same config as @noway and this is a very valid issue.
Hey @noway.. After a lot of tries, this set up got everything (even first open after install scenario) working for me. Can you check this out and let me know: https://medium.com/@ramakrishnan_89356/firebase-dynamic-links-for-your-react-native-app-ios-setup-only-c6e1f5a7944e
@ram95krishh through no power that I actually have, I grant you 10 internet points for writing such an excellent detailed guide for future people :-)
@mikehardy Haha, thanks mate, that means a lot :D
This does look like an interesting approach, I gonna need to try it out. Atm we just have broken implementation in production and we remedy it by just trigerring stuff we need on first sign up.
For me the issue wasn't solved with the code in that article. This is because I was using a custom domain and this hasn't been documented properly.
The solution for me was the default code from the rn-firebase docs and adding the custom domain to the Info.plist file:
<key>FirebaseDynamicLinksCustomDomains</key>
<array>
<string>https://my.custom.domain</string>
</array>
@RWOverdijk I have this in my project and I still experiencing the issue. This is not just a configuration error, the link works from cold start in iOS13 just fine, the bug seems to be present only on iOS12 for devices without home button.
The most promising workaround so far seems to be using Linking.getInitialURL()
alongside firebase.links().getInitialLink()
@noway Pretty sure that's not the case. Have you followed all the other steps? (capability and links in info).
Also, you need a release build (disable debug in build settings).
Update: Linking will work if you forward the results. But this will give you the short url (if you use those) which doesn't help.
@RWOverdijk yes I have followed capability and Info.plist steps. It works for me on iOS13 in release mode on App Store, but does not in iOS12. This is clearly not a configuration issue?
It works for me on iOS 12 so I think it might be. But I did write a lot of native code for other parts, too.
Maybe your version of React Native is in need of an update? Or maybe I just did something else to make it work and I don't know what. π
I'm using 0.60.5 as specified in the Environment section of this issue.
@RWOverdijk Thanks for pointing that out.. :)
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.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
@noway you ever get this solved? Im still struggling with getInitialLink not working on iOS. Android works perfect. onLink works perfect on iOS. its just getInitialLink on iOS that wont. I am on RNF 6.3.4 (latest) and RN0.61.4
@alittletf we just stopped testing for iOS12
@alittletf Did you find any solution to this? Facing the same issue
I don't know why, but if I manually build main.js and then try to use getInitialLink, it starts working. As a workaround. just an observation.
I'm still having this issue with devices on both iOS 14 and 13. I specified my custom domain in Info.plist.
Any idea what could be wrong?
No - best course is to reach into node_modules and add print logging of all arguments prior to making calls into native Objective-C, then similarly inside the Objective-C add print logging of all arguments prior to making calls to firebase-ios-sdk APIs, followed by print logging of all return values as it goes back up from firebase-ios-sdk API return values to native Objective-C return values in javascript up to what you get.
That typically takes about 5 minutes to do (4 minutes to google "how to print to log from objective-c", if you're me, every.time. 1 minute to do it) and should show where expectations are not matching reality
@mikehardy Sorry, staring at Objective-C for 30 minutes has done nothing but burn my eyes. Is there a debug branch I could use or a list of line numbers I can use to paste the print statement?
I thought I could get away with ignoring this issue as React Native's default Linking + the dynamic links parse function works in nearly every other scenario. However, initial install requires Dynamic Links' fancy clipboard scanning which I can only do by using getInitialLink(). Again, it works fine in debug, but not on release.
// add this up at the top
#include <React/RCTLog.h>
// somewhere else in the file
RCTLog(@"Hello world"); // can log anything that can turn into a string, most of the arguments can be strings?
As an aside, I will say even though it may not be helpful - I just reworked the way my "interruptive navigation on startup" works (like, when the app is opened with a link, or by a notification) so I was testing initial links quite heavily. And on iOS in release mode, getInitialLink is working for me. I literally tested it just now and it worked - it is definitely supposed to be working...
@mikehardy
Have you tried the install-survive clipboard feature?
I meant I didn't know where/what to log in Objective C (RNFBDynamicLinksAppDelegateInterceptor.m and RNFBDynamicLinksModule.m) as I could barely understand where functions start and end, let alone which arguments go where/are relevant.
Ooo! I have not tested the install-the-app-then-the-link-goes-in scenario recently as my dev environment is "release mode" and has a full-fledged firebase back-end but is not on the app stores.
It seems like it should be here: https://github.com/invertase/react-native-firebase/blob/f501fffbfc1baabe7fc7ed8185ad0c5be069134d/packages/dynamic-links/ios/RNFBDynamicLinks/RNFBDynamicLinksModule.m#L119
But this part may get caught up in things as well: https://github.com/invertase/react-native-firebase/blob/f501fffbfc1baabe7fc7ed8185ad0c5be069134d/packages/dynamic-links/ios/RNFBDynamicLinks/RNFBDynamicLinksAppDelegateInterceptor.m#L49
I'd be tempted to log all over the place, personally. How exactly are you testing these things from the install? Do you manually install your release build locally after being redirected to the app store ... or? I'm in this area with my app (as mentioned) so if you had a set of steps you're using I might be able to follow along and confirm or deny links are surviving install for me or not
@mikehardy I delete the app, open the dynamic link, click the "open" button in the preview page (since that automatically puts a special link in my clipboard). Then when I'm redirected to the App Store (you can fake this by giving it an AppStore ID for Facebook or something) I click "run" in Xcode (set to "Release" since it weirdly works in dev/debug mode).
Have you tried it not running from xcode? Xcode automatically attaches a debugger which causes other problems (crashlytics test crashes, so may not apply but it is a difference from a real user experience)
@mikehardy The bug is present in the App Store version of our app. For example: https://links.relearn.fyi/1AmPCrhfw5qE7The6
Ooo! I have not tested the install-the-app-then-the-link-goes-in scenario recently as my dev environment is "release mode" and has a full-fledged firebase back-end but is not on the app stores.
It seems like it should be here:
But this part may get caught up in things as well:
I'd be tempted to log all over the place, personally. How exactly are you testing these things from the install? Do you manually install your release build locally after being redirected to the app store ... or? I'm in this area with my app (as mentioned) so if you had a set of steps you're using I might be able to follow along and confirm or deny links are surviving install for me or not
I'm still not sure where to log here as I can't even tell what is and isn't a function call with arguments.
@mikehardy I started putting print statements in the ObjC and it seems like the function you mentioned (the app delegate interceptor) isn't even being run.
That would stand to reason if the link is not surviving, although as a negative test, it should run on regular app open or that indicates the wrong bit of control flow has been instrumented
That would stand to reason if the link is not surviving, although as a negative test, it should run on regular app open or that indicates the wrong bit of control flow has been instrumented
@mikehardy So where should I put the print statements? Getinitiallink never works in production, always works in debug, but the dynamic links listener always works.
@mikehardy Also important, my app reads the users clipboard on first install launch every time without fail even when I don't call getInitialLink. What does this indicate is working correctly? Why does this happen even when I don't ask for it?
There is inf upstream in firebase-ios-sdk about the clipboard behavior, in PRs and issues I think, for privacy reasons around the ios14 launch
https://github.com/firebase/firebase-ios-sdk/issues?q=+clipboard - not an overwhelming number, very interesting reading
@mikehardy did it work in your tests? Maybe try it with a custom linking domain (that's what I'm doing).
Edit: getInitialLink works when the link comes from the Apple Universal Links API (i.e., when I cold-open a dynamic link after first launch) It doesn't work on first launch after install.
I was in debug mode. Oops.
Why on Earth would it work in debug mode but not release mode?
@zaptrem Were you able to find a workaround? I'm also experiencing the same exact issue.
@zaptrem Were you able to find a workaround? I'm also experiencing the same exact issue.
Nope, I've been on break the past few days.
@mikehardy Any ideas?
None yet sorry - I should reopen it though! At any rate, my general take on it is that if a user goes to the trouble of following a dynamic link all the way through app install and the link isn't immediately connected, they'll likely try the link again at which point it will work. I want everything to work - but the failure mode is a success-on-retry so I haven't given it a lot of priority and I'm not sure I will have time to, sorry
None yet sorry -
Did it happen in your test build?
I followed the docs exactly and I'm having the same issue. The Dynamic Link redirects to the play store and dynamicLink.getInitialUrl() returns null on first launch after install. Works perfectly in Android though. I followed all of the recommendations earlier and nothing works. Is this an iOS bug and I have to find another way to do this?
I am unsure - this appears like it might be a firebase-ios-sdk bug but I don't recall if anyone did the native SDK reproduction attempt using https://github.com/firebase/quickstart-ios/tree/master/dynamiclinks yet
I have the same problem. On android it works perfectly, both in the first installation, and with an app already installed (closed or open). But with IOS it only works with the app installed (closed or open). In the first installation, getInitLink does not return anything. I have already searched the internet on all google pages and found no solution.
I believe that the way is to wait.
@junioroga Did you try the following suggestion? For me, it fixed the issue of getInitialLink
returning null on iOS 14.
For me the issue wasn't solved with the code in that article. This is because I was using a custom domain and this hasn't been documented properly.
The solution for me was the default code from the rn-firebase docs and adding the custom domain to the Info.plist file:
<key>FirebaseDynamicLinksCustomDomains</key> <array> <string>https://my.custom.domain</string> </array>
@pedromarta I tried, but it didn't work. I don't know if I'm testing the first installation of the app correctly. The getInitLink function works when the app is already installed, it doesn't work when I just installed the app and I press open on the AppStore and I'm redirected to the app.
One doubt, would the custom domain be myapp.page.link created there in the firebase console?
What is the correct way to test getInitLink on the first installation of the app?
@mikehardy Did this show up for you? @junioroga You say it doesn't work after first installation (same). Did you figure this out? Dynamic Links' getInitialLink() is completely broken in Release mode for me. I can work around it in most cases using Linking.getInitialURL() but that doesn't work on first launch since Dynamic Links has to read the clipboard.
After further investigation is I found that Firebase generated domains such as example.page.link link work after the app install, but custom domains for some reason don't. Custom domains do work if you enable the app preview page, but I don't want to use one because we've created a branded interstitial page to handle the app store redirect. I did add the custom domain to my FirebaseDynamicLinksCustomDomains array in my info.plist file, but it doesn't seem to matter. What is the myapp.page.link Firebase Domain doing that my custom domain isn't?
I have the app preview enabled and it still doesnβt work. getInitialURL doesnβt work at all in release mode, works perfectly in debug mode. Iβm using a custom domain but I tried the page link one a while ago and I donβt think it worked either.
On Mon, Mar 22, 2021 at 4:01 PM drencewicz @.***> wrote:
After further investigation is I found that Firebase generated domains such as example.page.link link work after the app install, but custom domains for some reason don't. Custom domains do work if you enable the app preview page, but I don't want to use one because we've created a branded interstitial page to handle the app store redirect. I did add the custom domain to my FirebaseDynamicLinksCustomDomains array in my info.plist file, but it doesn't seem to matter. What is the myapp.page.link Firebase Domain is doing that my custom domain isn't?
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/2660#issuecomment-804354781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMJTRX6LSL52DHUJCESBETTE6OW7ANCNFSM4I4FNJHQ .
I have the same problem. On android it works perfectly, both in the first installation, and with an app already installed (closed or open). But with IOS it only works with the app installed (closed or open). In the first installation, getInitLink does not return anything. I have already searched the internet on all google pages and found no solution.
I believe that the way is to wait.
The same for me, any updates?
The same for me, any updates?
Did you try setting FirebaseDynamicLinksCustomDomains
in Info.plist? That little detail sorted out my case.
FirebaseDynamicLinksCustomDomains
Thanks, will try in next release
EDIT: we think there is a workaround possible - https://github.com/invertase/react-native-firebase/issues/4548#issuecomment-1252028059
Issue
await dynamicLinks().getInitialLink()
works in debug mode, but doesn't work in release mode on iOS, on certain iPhones. Please not that the app does not crash, but rathernull
is returned byawait dynamicLinks().getInitialLink()
when it should be returning the dynamic link url.onLink
seems to be working fine, haven't noticed any issues with that. It is confirmed not to work on iPhone Xs with iOS 12.4.0 (device) and iPhone Xs with iOS 12.2.0 (Simulator). I use preview page in my links. Tested both from Safari via preview page and from Messages/Notes app, but NOT through App Store. See testing matrix:iPhone Xs with iOS 12.4.0 (device), debug: not tested iPhone Xs with iOS 12.4.0 (device), release: β broken iPhone Xs with iOS 12.2.0 (Simulator), debug: β works iPhone Xs with iOS 12.2.0 (Simulator), release: β broken iPhone Xs with iOS 13.0.0 (Simulator), debug: β works iPhone Xs with iOS 13.0.0 (Simulator), release: β works iPhone 7 Plus with iOS 12.4.1 (device), debug: β works iPhone 7 Plus with iOS 12.4.1 (device), release: β works
This issue is critical because it affects a significant amount of the iOS user base, I think it might be affecting any iPhone X and higher users who haven't updated to iOS 13 yet (i.e. everyone but the early adopters) which is a very substantial percentage of all iOS users.
The issue might be releated to https://github.com/invertase/react-native-firebase/issues/1901, and if so the issue has failed at least 2 Firebase customers, who since have chosen to switch to branch.io instead. See https://github.com/invertase/react-native-firebase/issues/1901#issuecomment-469242110 and https://github.com/invertase/react-native-firebase/issues/1901#issuecomment-477839585
Android is working flawlessly as far as I've tested, with getInitialLink, onLink, install through Play Store all working perfectly. Only issue is iOS.
Code I'm using:
Project Files
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, '9.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' target 'mycoolappapp' do # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/React' pod 'React-DevSupport', :path => '../node_modules/react-native/React' pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART' 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-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket' 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 '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' target 'mycoolappappTests' do inherit! :search_paths # Pods for testing end use_native_modules! end target 'mycoolappapp-tvOS' do # Pods for mycoolappapp-tvOS target 'mycoolappapp-tvOSTests' do inherit! :search_paths # Pods for testing end end target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.9.3', '< 3.0' end ``` #### `AppDelegate.m`: ```objc /** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import "AppDelegate.h" #import
#import
#import
#import
#import
#import
#import
@import Firebase;
@interface NSString(JB)
-(NSString *) stringValue;
@end
@implementation NSString(JB)
-(NSString *) stringValue {
return self;
}
@end
@implementation AppDelegate
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIROptions defaultOptions].deepLinkURLScheme = @"app.mycoolapp";
if ([FIRApp defaultApp] == nil) {
[FIRApp configure]; // It is recommended to add the line within the method BEFORE creating the RCTRootView
}
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"mycoolappapp"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:0.08f green:0.10f blue:0.15f alpha:1];
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
// FYI: Deprecated in iOS 9
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
BOOL isHandled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
if (!isHandled) {
isHandled = [[RNFBDynamicLinksAppDelegateInterceptor sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
return isHandled;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary *)options {
BOOL isHandled = [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options];
if (!isHandled) {
isHandled = [[RNFBDynamicLinksAppDelegateInterceptor sharedInstance] application:application openURL:url options:options];
}
return isHandled;
}
// FYI: Seems to double up the onLink call. But i added a memoized debounce there so should be all good.
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray> *))restorationHandler {
return [[RNFBDynamicLinksAppDelegateInterceptor sharedInstance] application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// 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];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
```
Android
Click To Expand
#### `android/build.gradle`: ```groovy // 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 supportLibVersion = "28.0.0" } repositories { google() jcenter() maven { url 'https://maven.google.com' } } dependencies { classpath("com.android.tools.build:gradle:3.5.0") classpath 'com.google.gms:google-services:4.3.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://maven.google.com' } } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" 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 * 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 = [ entryFile: "index.js", 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 = 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); android { compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "app.mycoolapp" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 236 versionName "2.3.6" multiDexEnabled true missingDimensionStrategy 'react-native-camera', 'general' } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { debug { keyAlias 'mycoolapp-android-alias' keyPassword 'ugh' storeFile file('/Users/ilia/mycoolapp/mycoolapp-release-key-android.jks') storePassword 'ugh' } } 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. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // 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 } } } packagingOptions { pickFirst '**/armeabi-v7a/libc++_shared.so' pickFirst '**/x86/libc++_shared.so' pickFirst '**/arm64-v8a/libc++_shared.so' pickFirst '**/x86_64/libc++_shared.so' pickFirst '**/x86/libjsc.so' pickFirst '**/armeabi-v7a/libjsc.so' } } dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.core:core:1.0.0' implementation 'androidx.multidex:multidex:2.0.1' implementation "com.google.android.gms:play-services-base:16.0.1" implementation "com.google.android.gms:play-services-location:16.0.0" implementation 'com.facebook.android:facebook-android-sdk:[5,6)' if (enableHermes) { def hermesPath = "../../node_modules/hermesvm/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation 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 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 = 'mycoolappapp' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':@react-native-mapbox-gl_maps' project(':@react-native-mapbox-gl_maps').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-mapbox-gl/maps/android/rctmgl') include ':app' ``` #### `MainApplication.java`: ```java package app.mycoolapp; import com.facebook.FacebookSdk; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import androidx.multidex.MultiDexApplication; import java.util.List; public class MainApplication extends MultiDexApplication implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @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 MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
FacebookSdk.setAdvertiserIDCollectionEnabled(true);
FacebookSdk.setAdvertiserIDCollectionEnabled(true);
FacebookSdk.setAutoInitEnabled(true);
FacebookSdk.fullyInitialize();
}
}
```
#### `AndroidManifest.xml`:
```xml
```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 10.14.6 CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz Memory: 349.36 MB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 12.6.0 - ~/.nvm/versions/node/v12.6.0/bin/node npm: 6.11.3 - ~/.nvm/versions/node/v12.6.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 11.0/11A420a - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: ^0.60.5 => 0.60.5 ``` - **Platform that you're experiencing the issue on**: - [x] 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:** ``` "@react-native-firebase/app": "^6.0.0", "@react-native-firebase/auth": "^6.0.0", "@react-native-firebase/dynamic-links": "^6.0.0", ``` - **`Firebase` module(s) you're using that has the issue:** - `DynamicLinks` - **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]React Native Firebase
andInvertase
on Twitter for updates on the library.