flurry / react-native-flurry-sdk

React Native Flurry SDK
Apache License 2.0
45 stars 13 forks source link

Cannot read property 'initBuilder' of undefined #15

Closed pouya92 closed 5 years ago

pouya92 commented 5 years ago

Hi, I'm getting this error when calling Builder method Cannot read property 'initBuilder' of undefined

here is my dependencies: "dependencies": { "@react-native-community/async-storage": "^1.3.3", "lottie-react-native": "^2.6.1", "react": "16.8.4", "react-native": "^0.59.6", "react-native-background-timer": "^2.1.1", "react-native-base64": "0.0.2", "react-native-firebase": "~5.5.5", "react-native-flurry-sdk": "^3.7.0", "react-native-gesture-handler": "^1.0.16", "react-native-keep-awake": "^4.0.0", "react-native-sound": "^0.10.12", "react-native-svg": "^9.2.4", "react-native-walkthrough-tooltip": "^0.6.1", "react-native-webview": "^5.12.1", "react-navigation": "^3.3.2", "react-redux": "^7.0.2", "realm": "^2.29.0", "redux": "^4.0.1" },

poting-oath commented 5 years ago

Under what platform you are getting this error message?

pouya92 commented 5 years ago

Hi, i’m getting this error on ios

pouya92 commented 5 years ago

I'm using react native 0.59.6 with pod. So I tried 3.7.0 version and it shows me this error 'Cannot read property 'initBuilder' of undefined', also when I try to use latest version with pod I will get this error ''FConfig.h' file not found'

pouya92 commented 5 years ago

I also check my Header Search Path I found : $(SRCROOT)/../node_modules/react-native-flurry-sdk/ios/ReactNativeFlurry

xnth97 commented 5 years ago

Hi @pouya92 ,

Thank you for using Flurry. Since you are using CocoaPods, we recommend that you use the latest version, which works fine with RN 0.59.6 for me. Please make sure you have something like

pod 'react-native-flurry-sdk', :path => '../node_modules/react-native-flurry-sdk/ios'

in your Podfile. Also please make sure that there's no libReactNativeFlurry.a or libReactNativeFlurryWithMessaging.a under Linked Frameworks and Libraries section if you have linked a previous version of this package.

Please let me know if this problem still occurs.

pouya92 commented 5 years ago

I did pod install on both versions but always lead to error. I'll do as follow and let you know the result ASAP: 1- npm install react-native-flurry-sdk --save 2- react-native link react-native-flurry-sdk 3 - check the Pod file and make sure pod 'react-native-flurry-sdk', :path => '../node_modules/react-native-flurry-sdk/ios' exist 4- pod Update and check if it works or not...

pouya92 commented 5 years ago

I got 4 errors after those steps : 1 - 'FConfig.h' file not found in ==> ReactNativeFlurryWithMessaging Group 2,3,4 - Too many arguments to block call, expected 1, have 3 in ==> react-native-flurry-sdk Group

xnth97 commented 5 years ago

Hi @pouya92 ,

Please remove groups under Libraries with prefix ReactNativeFlurry. Also please remove libReactNativeFlurry.a or libReactNativeFlurryWithMessaging.a under Linked Frameworks and Libraries section.

Usually as Linking Libraries doc says, the library should be linked with cocoapods, hence groups under Libraries can be removed.

pouya92 commented 5 years ago

Well I check Linked Frameworks and Libraries and removed libReactNativeFlurry.a, libReactNativeFlurryWithMessaging.a but still get these errors

xnth97 commented 5 years ago

Can you please show me the 2,3,4 errors? Thank you

FYI, my project looks like this

screenshot

And my Podfile is like

platform :ios, '9.0'

target 'testproj' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for testproj

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # Needed for debugging
    'RCTAnimation', # Needed for FlatList and animations running on native UI thread
    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  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 'react-native-flurry-sdk', :path => '../node_modules/react-native-flurry-sdk/ios'

end

Dependencies

"dependencies": {
    "react": "16.8.6",
    "react-native": "0.59.6",
    "react-native-flurry-sdk": "^4.1.0"
  },

This works fine for me.

pouya92 commented 5 years ago

this is error 2,3,4 screenshot Screen Shot 2019-08-20 at 10 14 35 AM

My project tree: Screen Shot 2019-08-20 at 10 19 18 AM Screen Shot 2019-08-20 at 10 19 35 AM

my Pod file:

platform :ios, '9.0' target 'xgame' do pod 'Firebase/Core', '~> 6.3.0' pod 'Firebase/Messaging', '~> 6.3.0'

pod 'react-native-flurry-sdk', :path => '../node_modules/react-native-flurry-sdk/ios'

target 'xgameTests' do inherit! :search_paths

end end

"dependencies": { "@react-native-community/async-storage": "^1.3.3", "lottie-react-native": "^2.6.1", "react": "16.8.4", "react-native": "^0.59.6", "react-native-background-timer": "^2.1.1", "react-native-base64": "0.0.2", "react-native-firebase": "~5.5.5", "react-native-flurry-sdk": "^4.1.0", "react-native-gesture-handler": "^1.0.16", "react-native-keep-awake": "^4.0.0", "react-native-sound": "^0.10.12", "react-native-svg": "^9.2.4", "react-native-walkthrough-tooltip": "^0.6.1", "react-native-webview": "^5.12.1", "react-navigation": "^3.3.2", "react-redux": "^7.0.2", "realm": "^2.29.0", "redux": "^4.0.1" },

pouya92 commented 5 years ago

I also deleted ReactNativeFlurry.xcodeproj from Libraries and now error 2,3,4 that I mentioned remained. Screen Shot 2019-08-20 at 10 33 00 AM

xnth97 commented 5 years ago

Thank you for feedback. From the screenshot I see that you are actually not using CocoaPods for RN integration. I think you could either use CocoaPods for RN integration by adding React pod to your Podfile, or use react-native-flurry-sdk@3.7.0 by

npm install react-native-flurry-sdk@3.7.0 --save
react-native unlink react-native-flurry-sdk && react-native link react-native-flurry-sdk

My test project using RN 0.59.6 and react-native-flurry-sdk@3.7.0 looks like

sc

pouya92 commented 5 years ago

Actually I went this way and succeed to build my project, but I got this error 'Cannot read property 'initBuilder' of undefined' when I called Builder method.

I will try again and let you know ASAP.

pouya92 commented 5 years ago

I still get that error: after Installing I linked successfully : Screen Shot 2019-08-20 at 11 08 26 AM

and after that I tried to import it: Screen Shot 2019-08-20 at 11 13 15 AM

and finaly I tried to run the app but I get this error: Screen Shot 2019-08-20 at 11 13 33 AM

pouya92 commented 5 years ago

I managed to solve this problem by: 1- install latest SDK version 2- add your pods for react to my pod file and update my Pod with pod update and now it's working Do I need to run react-native link react-native-flurry-sdk for android or do this manually?

xnth97 commented 5 years ago

Hi @pouya92 ,

Glad to know that! Well since you are now using CocoaPods for RN integration, the react-native link command will use CocoaPods for iOS as well, therefore I think you can feel free to run the command for android. However I'm not sure about your environment and why it caused the above-mentioned problems, so I would suggest to backup your project before doing that.

Thanks