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.63k stars 2.2k forks source link

[🐛] Failed to Build dynamic link on Android #5661

Closed enesdedeoglu closed 3 years ago

enesdedeoglu commented 3 years ago

Issue

Describe your issue here

While trying to create short dynamic links on Android I am getting error, IOS is working fine.buildLink() gives same error too.

I use analytics in this project and it is working fine.

Code to create dynamic link:

 async  buildLink(id) {
      const link = await dynamicLinks().buildShortLink({
        link: 'https://clubhotelrama.page.link/'+id,
        // domainUriPrefix is created in your Firebase console
        domainUriPrefix: 'https://clubhotelrama.page.link',
        android:{
          packageName:"com.artin.clubhotelrama",
        }
        ,
        ios:{
          bundleId:"com.artin.ClubHotelRama"
        }
      }, dynamicLinks.ShortLinkType.UNGUESSABLE);
    console.log("link",link)
     this.setState({isVisible:true,text:link})
     return link;
    }

The error from console:

Error: [dynamicLinks/build-failed] java.lang.NoSuchFieldError: No static field NO_OPTIONS of type Lcom/google/android/gms/common/api/Api$ApiOptions$NoOptions; in class Lcom/google/android/gms/common/api/Api$ApiOptions; or its superclasses (declaration of 'com.google.android.gms.common.api.Api$ApiOptions' appears in /data/app/com.artin.clubhotelrama-_q2G0Bowu5xpnvCRkO25-Q==/base.apk!classes2.dex) NativeFirebaseError: [dynamicLinks/build-failed] java.lang.NoSuchFieldError: No static field NO_OPTIONS of type Lcom/google/android/gms/common/api/Api$ApiOptions$NoOptions; in class Lcom/google/android/gms/common/api/Api$ApiOptions; or its superclasses (declaration of 'com.google.android.gms.common.api.Api$ApiOptions' appears in /data/app/com.artin.clubhotelrama-_q2G0Bowu5xpnvCRkO25-Q==/base.apk!classes2.dex)

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "ClubHotelRama", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-community/async-storage": "^1.9.0", "@react-native-community/cameraroll": "^4.0.4", "@react-native-community/netinfo": "^5.7.1", "@react-native-firebase/analytics": "^12.7.3", "@react-native-firebase/app": "^12.7.3", "@react-native-firebase/dynamic-links": "^12.7.3", "@react-navigation/native": "^5.8.10", "axios": "^0.19.2", "buffer": "^5.6.0", "d3-shape": "^1.3.7", "dates-between": "^1.1.0", "formik": "^2.2.6", "lightbox": "^0.5.0", "moment": "^2.24.0", "native-base": "^2.13.12", "react": "16.11.0", "react-native": "0.62.2", "react-native-3dcube-navigation": "^1.0.4", "react-native-base64": "^0.2.1", "react-native-calendars": "^1.265.0", "react-native-camera": "^3.43.1", "react-native-datepicker": "^1.7.2", "react-native-device-info": "^5.5.5", "react-native-double-click": "^1.0.5", "react-native-fast-image": "^8.1.5", "react-native-flip": "^0.1.8", "react-native-flip-card": "^3.5.5", "react-native-fs": "^2.18.0", "react-native-full-screen": "0.0.2", "react-native-gesture-handler": "^1.6.1", "react-native-i18n": "^2.0.15", "react-native-iap": "^4.4.6", "react-native-image-zoom-viewer": "^2.2.27", "react-native-immersive": "^2.0.0", "react-native-immersive-mode": "^1.1.0", "react-native-inappbrowser-reborn": "^3.4.0", "react-native-lightbox": "^0.8.1", "react-native-linear-gradient": "^2.5.6", "react-native-localize": "^1.4.0", "react-native-looped-carousel": "^0.1.13", "react-native-maps": "^0.27.1", "react-native-masked-text": "^1.13.0", "react-native-modal": "^11.5.6", "react-native-modal-animated": "0.0.2", "react-native-modalbox": "^2.0.0", "react-native-navigation-bar-color": "^2.0.1", "react-native-odoo-promise-based": "^0.6.8", "react-native-onesignal": "^3.7.2", "react-native-options-menu": "^2.0.2", "react-native-progress": "^4.1.2", "react-native-qrcode-svg": "^6.1.1", "react-native-reanimated": "^1.8.0", "react-native-rename": "^2.4.1", "react-native-render-html": "^4.2.0", "react-native-render-html-table-bridge": "^0.5.3", "react-native-responsive-dimensions": "^3.1.1", "react-native-responsive-screen": "^1.4.1", "react-native-restart": "0.0.14", "react-native-router-flux": "^4.2.0", "react-native-router-flux-focus-hook": "github:leifdenby/react-native-router-flux-focus-hook", "react-native-scaling-drawer": "^1.0.1", "react-native-screens": "^2.5.0", "react-native-scrollable-tab-view": "^1.0.0", "react-native-share": "^3.8.5", "react-native-snap-carousel": "^3.9.0", "react-native-sound": "^0.11.0", "react-native-star-rating": "^1.1.0", "react-native-story": "^0.1.3", "react-native-svg": "^12.1.0", "react-native-swipe-gestures": "^1.0.5", "react-native-swipebox": "0.0.5", "react-native-swipeout": "^2.3.6", "react-native-swiper": "^1.6.0", "react-native-tab-view": "^2.14.0", "react-native-timed-slideshow": "^1.2.1", "react-native-vector-icons": "^6.6.0", "react-native-webview": "^9.4.0", "rn-fetch-blob": "^0.12.0", "yup": "^0.32.9" }, "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", "metro-react-native-babel-preset": "^0.58.0", "react-test-renderer": "16.11.0" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby platform :ios, '10.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' def add_flipper_pods!(versions = {}) versions['Flipper'] ||= '~> 0.87.0' versions['DoubleConversion'] ||= '1.1.7' versions['Flipper-Folly'] ||= '~> 2.5.3' versions['Flipper-Glog'] ||= '0.3.6' versions['Flipper-PeerTalk'] ||= '~> 0.0.4' versions['Flipper-RSocket'] ||= '~> 1.3.1' pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug' # List all transitive dependencies for FlipperKit pods # to avoid them being linked in Release builds pod 'Flipper', versions['Flipper'], :configuration => 'Debug' pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug' pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug' pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug' pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug' pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug' pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug' end # Post Install processing for Flipper def flipper_post_install(installer) installer.pods_project.targets.each do |target| if target.name == 'YogaKit' target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.1' end end find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm", "_initializeModules:(NSArray> *)modules", "_initializeModules:(NSArray *)modules") find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm", "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))") find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm", "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))") # Enable Flipper for simulators only if target.name.start_with?('Flipper') target.build_configurations.each do |config| config.build_settings['VALID_ARCHS'] = 'arm64 arm64e' end end end end target 'ClubHotelRama' do # Pods for ClubHotelRama 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/callinvoker', :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', :modular_headers => true 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' pod 'Google-Mobile-Ads-SDK' # pod 'react-native-admob', path: '../node_modules/react-native-admob' pod 'RNFS', :path => '../node_modules/react-native-fs' pod 'react-native-cameraroll', :path => '../node_modules/@react-native-community/cameraroll' target 'ClubHotelRamaTests' do inherit! :complete # Pods for testing end use_native_modules! # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. # add_flipper_pods! # post_install do |installer| # flipper_post_install(installer) # end end target 'ClubHotelRama-tvOS' do # Pods for ClubHotelRama-tvOS target 'ClubHotelRama-tvOSTests' do inherit! :search_paths # Pods for testing end end target 'OneSignalNotificationServiceExtension' do pod 'OneSignal', '>= 2.9.3', '< 3.0' end def find_and_replace(dir, findstr, replacestr) Dir[dir].each do |name| text = File.read(name) replace = text.gsub(findstr,replacestr) if text != replace puts "Fix: " + name File.open(name, "w") { |file| file.puts replace } STDOUT.flush end end Dir[dir + '*/'].each(&method(:find_and_replace)) end ``` #### `AppDelegate.m`: ```objc // N/A ```


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 // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "29.0.3" minSdkVersion = 16 compileSdkVersion = 29 targetSdkVersion = 29 supportLibVersion = "29.0.0" androidXAnnotation = "1.1.0" androidXBrowser = "1.0.0" } subprojects { subproject -> afterEvaluate{ if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion } } } } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.5.2") classpath 'com.google.gms:google-services:4.3.10' // 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://jitpack.io" } } } ``` #### `android/app/build.gradle`: ```groovy buildscript { repositories { maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal } dependencies { classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]' } } apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' apply plugin: "com.android.application" apply plugin: 'com.google.gms.google-services' import com.android.build.OutputFile 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 "com.artin.clubhotelrama" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 7 versionName "1.0.5" multiDexEnabled true missingDimensionStrategy 'react-native-camera', 'general' } dexOptions { javaMaxHeapSize "4g" } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { release { if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) { storeFile file(MYAPP_UPLOAD_STORE_FILE) storePassword MYAPP_UPLOAD_STORE_PASSWORD keyAlias MYAPP_UPLOAD_KEY_ALIAS keyPassword MYAPP_UPLOAD_KEY_PASSWORD } } } buildTypes { debug { signingConfig signingConfigs.debug } release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" signingConfig signingConfigs.release } } 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 } } } } configurations.all { resolutionStrategy { force "com.google.android.gms:play-services-base:16.1.0" force "com.google.android.gms:play-services-gcm:16.1.0" force "com.google.android.gms:play-services-ads:17.2.0" } } 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" implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation project(':react-native-sound') implementation project(':rn-fetch-blob') implementation project(':react-native-webview') implementation project(':react-native-vector-icons') implementation project(':react-native-svg') implementation project(':react-native-share') implementation project(':react-native-restart') implementation project(':react-native-reanimated') implementation project(':react-native-onesignal') implementation project(':react-native-navigation-bar-color') implementation project(':react-native-maps') implementation project(':react-native-localize') implementation project(':react-native-linear-gradient') implementation project(':react-native-inappbrowser-reborn') implementation project(':react-native-immersive-mode') implementation project(':react-native-immersive') compile project(':react-native-iap') implementation project(':react-native-i18n') implementation project(':react-native-gesture-handler') implementation project(':react-native-full-screen') implementation project(':react-native-fast-image') implementation project(':react-native-device-info') implementation project(':react-native-camera') implementation project(':@react-native-community_viewpager') implementation project(path: ":@react-native-firebase_app") implementation project(path: ":@react-native-firebase_analytics") implementation project(path: ":@react-native-firebase_dynamic-links") //compile project(':RNAdMob') implementation project(':@react-native-community_netinfo') implementation project(':@react-native-community_async-storage') implementation 'androidx.multidex:multidex:2.0.1' 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") } 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) ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'ClubHotelRama' include ':@react-native-community_cameraroll' project(':@react-native-community_cameraroll').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/cameraroll/android') include ':react-native-fs' project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android') include ':react-native-iap' project(':react-native-iap').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-iap/android') include ':react-native-sound' project(':react-native-sound').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sound/android') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':rn-fetch-blob' project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android') include ':react-native-webview' project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':react-native-svg' project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android') include ':react-native-share' project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android') include ':react-native-restart' project(':react-native-restart').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-restart/android') include ':react-native-reanimated' project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android') include ':react-native-onesignal' project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android') include ':react-native-navigation-bar-color' project(':react-native-navigation-bar-color').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation-bar-color/android') include ':react-native-maps' project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android') include ':react-native-localize' project(':react-native-localize').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localize/android') include ':react-native-linear-gradient' project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android') include ':react-native-inappbrowser-reborn' project(':react-native-inappbrowser-reborn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-inappbrowser-reborn/android') include ':react-native-immersive-mode' project(':react-native-immersive-mode').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-immersive-mode/android') include ':react-native-immersive' project(':react-native-immersive').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-immersive/android') include ':react-native-i18n' project(':react-native-i18n').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-i18n/android') include ':react-native-gesture-handler' project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android') include ':react-native-full-screen' project(':react-native-full-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-full-screen/android') include ':react-native-fast-image' project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android') include ':react-native-device-info' project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') include ':RNAdMob', ':app' project(':RNAdMob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-admob/android') include ':@react-native-community_netinfo' project(':@react-native-community_netinfo').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/netinfo/android') include ':@react-native-community_async-storage' project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android') include ':react-native-camera' project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android') include ':@react-native-community_viewpager' project(':@react-native-community_viewpager').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/viewpager/android') include ':app' include ':@react-native-firebase_app' project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/app/android') include ':@react-native-firebase_dynamic-links' project(':@react-native-firebase_dynamic-links').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/dynamic-links/android') include ':@react-native-firebase_analytics' project(':@react-native-firebase_analytics').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/analytics/android') ``` #### `MainApplication.java`: ```java package com.artin.clubhotelrama; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.reactnativecommunity.cameraroll.CameraRollPackage; import com.rnfs.RNFSPackage; import com.dooboolab.RNIap.RNIapPackage; import com.zmxv.RNSound.RNSoundPackage; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; import com.RNFetchBlob.RNFetchBlobPackage; import com.reactnativecommunity.webview.RNCWebViewPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.horcrux.svg.SvgPackage; import cl.json.RNSharePackage; import com.avishayil.rnrestart.ReactNativeRestartPackage; import com.swmansion.reanimated.ReanimatedPackage; import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage; import com.thebylito.navigationbarcolor.NavigationBarColorPackage; import com.airbnb.android.react.maps.MapsPackage; import com.reactcommunity.rnlocalize.RNLocalizePackage; import com.BV.LinearGradient.LinearGradientPackage; import com.proyecto26.inappbrowser.RNInAppBrowserPackage; import com.rnimmersivemode.RNImmersiveModePackage; import com.rnimmersive.RNImmersivePackage; import com.AlexanderZaytsev.RNI18n.RNI18nPackage; import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; import com.rn.full.screen.FullScreenModule; import com.dylanvann.fastimage.FastImageViewPackage; import com.learnium.RNDeviceInfo.RNDeviceInfo; //import com.sbugert.rnadmob.RNAdMobPackage; import com.reactnativecommunity.netinfo.NetInfoPackage; import com.reactnativecommunity.asyncstorage.AsyncStoragePackage; import org.reactnative.camera.RNCameraPackage; import com.reactnativecommunity.viewpager.RNCViewPagerPackage; import com.facebook.react.shell.MainReactPackage; import androidx.multidex.MultiDexApplication; import io.invertase.firebase.app.ReactNativeFirebaseAppPackage; import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage; import io.invertase.firebase.dynamiclinks.ReactNativeFirebaseDynamicLinksPackage; import java.util.Arrays; 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() { return Arrays.asList( new MainReactPackage(), new CameraRollPackage(), new RNFSPackage(), new RNIapPackage(), new RNSoundPackage(), new RNFetchBlobPackage(), new RNCWebViewPackage(), new VectorIconsPackage(), new SvgPackage(), new RNSharePackage(), new ReactNativeRestartPackage(), new ReanimatedPackage(), new ReactNativeOneSignalPackage(), new NavigationBarColorPackage(), new MapsPackage(), new RNLocalizePackage(), new LinearGradientPackage(), new RNInAppBrowserPackage(), new RNImmersiveModePackage(), new RNImmersivePackage(), new RNI18nPackage(), new RNGestureHandlerPackage(), new FullScreenModule(), new FastImageViewPackage(), new RNDeviceInfo(), new NetInfoPackage(), new AsyncStoragePackage(), new RNCameraPackage(), new RNCViewPagerPackage(), new ReactNativeFirebaseAppPackage(), new ReactNativeFirebaseAnalyticsPackage(), new ReactNativeFirebaseDynamicLinksPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { 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.artin.clubhotelrama.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } } ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 11.5.2 CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz Memory: 378.05 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.4.0 - /usr/local/bin/node Yarn: Not Found npm: 6.14.4 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: API Levels: 23, 27, 28, 29 Build Tools: 25.0.0, 26.0.1, 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.2 System Images: android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.6953283 Xcode: 12.5/12E262 - /usr/bin/xcodebuild Languages: Java: 1.8.0_252 - /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 ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 12.7.3` - **`Firebase` module(s) you're using that has the issue:** - `Dynamic Links` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`


mikehardy commented 3 years ago

Hi there! A quick google shows me you have a play services issue.

Dynamic links requires play services https://firebase.google.com/docs/android/android-play-services#google_play_services_required_or_recommended

You may use these APIs to determine if the requirements are met and maybe even handle some classes of error (outdated play services): https://rnfirebase.io/app/utils#android---checking-play-services

enesdedeoglu commented 3 years ago

I added the required play services then checked with these APIs but it returns all good and valid. The error is same

implementation platform('com.google.firebase:firebase-bom:28.4.0')
implementation "com.google.firebase:firebase-dynamic-links"
implementation "com.google.firebase:firebase-analytics"
mikehardy commented 3 years ago

That's really unexpected. Those errors are (by my searching) always play services errors. There's nothing we're doing in this module that should affect this :thinking: - the best I can think of is a quick native quickstart to generate a https://stackoverflow.com/help/minimal-reproducible-example for firebase-android-sdk - https://github.com/firebase/quickstart-android/tree/master/dynamiclinks - I wish I had more to offer but this really really seems like a "play store services missing" type issue - I'll keep this open but I can say we exercise this all the time here - https://github.com/invertase/react-native-firebase/blob/600dee0547423e3a9e1cce2451aad5f95c5e28dd/packages/dynamic-links/e2e/dynamicLinks.e2e.js#L33 - that method is the bedrock of the e2e tests since all the others build on the links returned

enesdedeoglu commented 3 years ago

I solved the issue by recreating android folder. I copied necessary parts to new android folder from previous one. Then it works. Thanks for your help

mikehardy commented 3 years ago

Glad to hear - that really was a strange one!