AdaptySDK-React-Native: Adapty NativeModule is not defined
Description
I’m experiencing this while migrating our bare React Native 0.73.4 project to Expo 52 CNG setup. The installation guide doesn’t help as we’re not using EAS Build yet; we want to stick to expo run:* for now to avoid wasting the free quota of build count.
Could someone provide any clue about what might cause this error?
Few notes:
- We’re already using Adapty for years. Before integrating Expo, Adapty SDK just worked.
- We’re using pnpm 8.10.2 for package management.
- I know
react-native-adapty2.11.3 is outdated, but upgrading to 3.0.1 didn’t solve the issue.
Version
v2.11.3
What platforms are you seeing the problem on?
Android
System info
System:
OS: macOS 15.0
CPU: (8) arm64 Apple M1
Memory: 82.44 MB / 16.00 GB
Shell:
version: 3.7.1
path: /opt/homebrew/bin/fish
Binaries:
Node:
version: 18.18.2
path: ~/.local/share/mise/installs/node/18.18.2/bin/node
Yarn: Not Found
npm:
version: 9.8.1
path: ~/.local/share/mise/installs/node/18.18.2/bin/npm
Watchman:
version: 2024.08.19.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/yuhr/.local/share/mise/installs/ruby/3.2.1/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.0
- iOS 18.0
- macOS 15.0
- tvOS 18.0
- visionOS 2.0
- watchOS 11.0
Android SDK:
API Levels:
- "29"
- "30"
- "31"
- "32"
- "33"
- "34"
- "35"
Build Tools:
- 28.0.3
- 29.0.2
- 30.0.2
- 30.0.3
- 31.0.0
- 32.0.0
- 33.0.0
- 33.0.1
- 34.0.0
- 35.0.0
System Images:
- android-29 | Google APIs ARM 64 v8a
- android-32 | Google APIs ARM 64 v8a
- android-32 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7935034
Xcode:
version: 16.0/16A242d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /Users/yuhr/.local/share/mise/installs/java/adoptopenjdk-17.0.10+7/bin/javac
Ruby:
version: 3.2.1
path: /Users/yuhr/.local/share/mise/installs/ruby/3.2.1/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 12.3.4
wanted: ^12.3.4
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.2
wanted: 0.76.2
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 28 (9 by maintainers)
Hi @yuhr @Bjarkinn
Could you please try
3.0.2-canary.0?What commands are you running @MuhammedYesilyurt @vladd-g ?
I ran expo start -c and rm -rf node_modules and yarn install
@vladd-g Iam using this versions but still getting same error: “@adapty/react-native-ui”: “^3.0.1”, “react-native-adapty”: “^3.0.2-canary.0”,
Hi @yuhr, thank you for the report!
We’re working on making expo auto-linking work! Could you try disabling the expo auto-linking for now?
Hello, the app is working fine for me when i run
expo run:ios, but as soon as I want to build it with eas it fails with the same error. I installed all the latest versions as you said:@vladd-g @moe12572 I just clean the project then I rebuild the project by expo so its working successfully now but iam getting error on another process;
const placementId = ‘xx-placement’; const paywall = await adapty.getPaywall(placementId); i receive 200 response but the detailed error is:
[2024-11-30T18:01:50.995Z] [adapty@3.0.2-canary.0] “fetch/get_paywall”: Calling bridge function: OK {“error”: [Error: {“type”:“AdaptyError”,“data”:{“adapty_code”:2006,“message”:“Response decoding failed”,“detail”:“HTTPError.decoding(GET /sdk/in-apps/public_live_1Qb3CUdj/paywall/variations/xx-placement/caf8b348824cb3c376826a993faa8a39/, [3.0.3]: Adapty/HTTPRequestWithDecodableResponse.swift#61, statusCode: 200, dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _CodingKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "attributes", intValue: nil), CodingKeys(stringValue: "paywall_builder", intValue: nil), ContainerCodingKeys(stringValue: "paywall_builder_config", intValue: nil), CodingKeys(stringValue: "assets", intValue: nil), _CodingKey(stringValue: "Index 113", intValue: 113), CodingKeys(stringValue: "value", intValue: nil)], debugDescription: "Encountered Data is not valid Base64.", underlyingError: nil)))”}}]} DEBUG [2024-11-30T18:01:50.997Z] [adapty@3.0.2-canary.0] “getPaywall”: Calling method: OK {“error”: [Error: #2006 (decodingFailed): Response decoding failed]}
@vladd-g I’m using Expo Go on iOS (iPhone only). Still getting the same issue: Adapty NativeModule is not defined.
Package.json…
{ "name": "scribble-mobile", "version": "1.0.0", "main": "expo/AppEntry.js", "scripts": { "start": "expo start", "tunnel": "expo start --tunnel", "updates": "npx eas update", "android": "DARK_MODE=media expo run:android", "ios": "DARK_MODE=media expo run:ios", "web": "DARK_MODE=media expo start --web" }, "dependencies": { "@adapty/react-native-ui": "^3.0.1", "@expo/ngrok": "^4.1.0", "@expo/vector-icons": "^14.0.2", "@gorhom/bottom-sheet": "^4.6.4", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-clipboard/clipboard": "^1.15.0", "@react-native-community/masked-view": "^0.1.11", "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/native": "^6.1.17", "@react-navigation/stack": "^6.3.29", "@rneui/base": "^4.0.0-rc.8", "@rneui/themed": "^4.0.0-rc.8", "@supabase/supabase-js": "^2.43.4", "@types/react": "~18.3.12", "base64-arraybuffer": "^1.0.2", "eas-cli": "^9.0.8", "expo": "^52.0.11", "expo-av": "~15.0.1", "expo-clipboard": "^7.0.0", "expo-constants": "~17.0.3", "expo-file-system": "~18.0.4", "expo-keep-awake": "~14.0.1", "expo-linear-gradient": "^14.0.1", "expo-sharing": "^13.0.0", "expo-status-bar": "~2.0.0", "expo-updates": "~0.26.9", "global": "^4.4.0", "install": "^0.13.0", "lottie-react-native": "7.1.0", "npx": "^10.2.2", "react": "18.3.1", "react-native": "0.76.3", "react-native-adapty": "^3.0.2-canary.0", "react-native-audio-recorder-player": "^3.6.7", "react-native-audio-visualizer": "^0.0.1", "react-native-gesture-handler": "~2.20.2", "react-native-reanimated": "^3.16.3", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "4.12.0", "react-native-screens": "~4.1.0", "react-native-svg": "15.8.0", "react-native-url-polyfill": "^2.0.0", "react-native-webview": "13.12.2", "typescript": "~5.3.3", "wavesurfer.js": "^7.7.15", "zustand": "^5.0.1" }, "devDependencies": { "@babel/core": "^7.20.0", "expo-asset": "~11.0.1", "react-native-svg-transformer": "^1.5.0" }, "private": true }@MuhammedYesilyurt @moe12572 Could you please try a clean and prebuild?