Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error for Android on latest React Native 0.76 with new architecture enabled #185

Open
4 tasks done
adrianso opened this issue Nov 27, 2024 · 12 comments · May be fixed by #194
Open
4 tasks done

Compilation error for Android on latest React Native 0.76 with new architecture enabled #185

adrianso opened this issue Nov 27, 2024 · 12 comments · May be fixed by #194
Assignees
Labels
bug Something isn't working evergreen

Comments

@adrianso
Copy link

Checklist

  • I have read the contributing guidelines
  • I have determined whether this bug is also reproducible in a vanilla project, such as the example app in this repository.
  • If possible, I've reproduced the issue using the master branch or latest release of this package.
  • This issue hasn't been addressed in an existing issue or pull request

Description

The SDK does not compile for Android in React Native 0.76.3 when new architecture is enabled.

Expected behavior

I expect the SDK to compile properly.

Actual behavior

I receive the following compilation error.

Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:663 throw parsingErrors[0]; ^ ModuleInterfaceNotFoundParserError: Module NativeKlaviyoReactNativeSdk: No TypeScript interfaces extending TurboModule were detected in this NativeModule spec. at throwIfModuleInterfaceNotFound (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/error-utils.js:65:11) at buildModuleSchema (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:787:3) at /Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:646:9 at guard (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/utils.js:31:14) at buildSchemaFromConfigType (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:645:22) at buildSchema (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:698:10) at TypeScriptParser.parseString (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/typescript/parser.js:134:12) at TypeScriptParser.parseFile (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/parsers/typescript/parser.js:131:17) at files.reduce.modules (/Users/adrian/Code/play/RN076/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema.js:90:31) at Array.reduce (<anonymous>) { nodes: [ Node { type: 'Program', start: 0, end: 888, loc: SourceLocation { start: Position { line: 1, column: 0, index: 0 }, end: Position { line: 28, column: 0, index: 888 }, filename: undefined, identifierName: undefined }, sourceType: 'module', interpreter: null, body: [ Node { type: 'ImportDeclaration', start: 0, end: 51, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, importKind: 'value', specifiers: [ [Node] ], source: Node { type: 'StringLiteral', start: 36, end: 50, loc: [SourceLocation], extra: [Object], value: 'react-native' }, attributes: [] }, Node { type: 'ImportDeclaration', start: 52, end: 100, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, importKind: 'type', specifiers: [ [Node] ], source: Node { type: 'StringLiteral', start: 85, end: 99, loc: [SourceLocation], extra: [Object], value: 'react-native' }, attributes: [] }, Node { type: 'ImportDeclaration', start: 101, end: 148, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, importKind: 'type', specifiers: [ [Node] ], source: Node { type: 'StringLiteral', start: 138, end: 147, loc: [SourceLocation], extra: [Object], value: './Event' }, attributes: [] }, Node { type: 'ImportDeclaration', start: 149, end: 200, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, importKind: 'type', specifiers: [ [Node] ], source: Node { type: 'StringLiteral', start: 188, end: 199, loc: [SourceLocation], extra: [Object], value: './Profile' }, attributes: [] }, Node { type: 'ImportDeclaration', start: 201, end: 246, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, importKind: 'type', specifiers: [ [Node] ], source: Node { type: 'StringLiteral', start: 237, end: 245, loc: [SourceLocation], extra: [Object], value: './Push' }, attributes: [], trailingComments: [ [Object] ] }, Node { type: 'ExportNamedDeclaration', start: 487, end: 742, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, exportKind: 'type', specifiers: [], source: null, declaration: Node { type: 'TSInterfaceDeclaration', start: 494, end: 742, loc: [SourceLocation], id: [Node], typeParameters: undefined, extends: [Array], body: [Node] }, leadingComments: [ [Object] ] }, Node { type: 'ExportNamedDeclaration', start: 744, end: 806, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, exportKind: 'type', specifiers: [], source: null, declaration: Node { type: 'TSInterfaceDeclaration', start: 751, end: 806, loc: [SourceLocation], id: [Node], typeParameters: undefined, extends: [Array], body: [Node] } }, Node { type: 'ExportDefaultDeclaration', start: 808, end: 887, loc: SourceLocation { start: [Position], end: [Position], filename: undefined, identifierName: undefined }, exportKind: 'value', declaration: Node { type: 'CallExpression', start: 823, end: 886, loc: [SourceLocation], callee: [Node], arguments: [Array], typeParameters: [Node] } } ], directives: [], extra: { topLevelAwait: false } } ]
} Node.js v20.17.0 FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':klaviyo-react-native-sdk:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 1 * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org. BUILD FAILED in 617ms.

Steps to reproduce

Here is a minimal repository to reproduce the issue.
https://github.com/adrianso/klaviyo-bug-repo

1. git clone https://github.com/adrianso/klaviyo-bug-repo
2. cd klaviyo-bug-repo 
2. npm install
3. npm run android

The Klaviyo React Native SDK version information

1.0.0

Environment Description

System: OS: macOS 15.1.1 CPU: (16) arm64 Apple M3 Max Memory: 13.58 GB / 64.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.18.0 path: ~/.volta/tools/image/node/20.18.0/bin/node Yarn: version: 1.22.22 path: ~/.volta/tools/image/yarn/1.22.22/bin/yarn npm: version: 10.8.2 path: ~/.volta/tools/image/node/20.18.0/bin/npm Watchman: version: 2024.11.25.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /Users/adrian/.rbenv/shims/pod SDKs: iOS SDK: Platforms: - DriverKit 24.1 - iOS 18.1 - macOS 15.1 - tvOS 18.1 - visionOS 2.1 - watchOS 11.1 Android SDK: Not Found IDEs: Android Studio: 2023.2 AI-232.10300.40.2321.11668458 Xcode: version: 16.1/16B40 path: /usr/bin/xcodebuild Languages: Java: version: 17.0.11 path: /usr/bin/javac Ruby: version: 2.6.10 path: /Users/adrian/.rbenv/shims/ruby npmPackages: "@react-native-community/cli": installed: 15.0.1 wanted: 15.0.1 react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.76.3 wanted: 0.76.3 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: Not found newArchEnabled: false

@adrianso adrianso added the bug Something isn't working label Nov 27, 2024
@ajaysubra
Copy link
Collaborator

Hey @adrianso Appreciate you providing the sample repo and steps to reproduce. We currently don't support turbo modules/new arch on react native. Could you please talk to the importance of us supporting new arch in your setup so that we can prioritize this accordingly. Thanks!

@adrianso
Copy link
Author

Hi @ajaysubra, thanks for replying to me so quickly.

Support for the new arch is very important for my (and many of your other client's) projects. It is now the default setting for all new React Native projects since version 0.76. New arch unleashes a whole lot of new features in React 18, e.g. Suspense, Transitions, automatic batching, etc. See more details here.

As far as I can see, you guys already support the new architecture on iOS with this ticket.
#150

Just need the Android implementation to catch up to the same level.

@ajaysubra ajaysubra pinned this issue Dec 11, 2024
@ShawnBaek
Copy link

@ajaysubra Has this issue been resolved?

@RiczCalixto
Copy link

RiczCalixto commented Jan 3, 2025

Any update here? This issue is very critical @ajaysubra

@evan-masseau
Copy link
Contributor

Hi folks, just want to acknowledge the importance of this update, thanks for your input. We’re fast-tracking this on our roadmap and will update here soon. Thanks for your patience through the holidays and happy new year!

@LdrPontes
Copy link

@evan-masseau Is there any update?

@mikep-reactiv
Copy link

@evan-masseau Any updates here? This is issue is preventing us from upgrading.

@nimitxjain
Copy link

we are similarly unable to upgrade our mobile app to the latest React Native because of this issue. it is a critical blocker. any updates are appreciated.

@IgorNoskov
Copy link

Hi! This is issue is preventing me from upgrading too.

@brunojabs
Copy link

@evan-masseau I also have a problem with this and I had to downgrade a bunch of libraries in order to keep using Klaviyo.

Do you have a timeline for this issue to be addressed? Is it still in the backlog or are you guys already working on this issue?

A timeline would help because depending on the timing I can decide if I wait for your update or implement your native libraries myself.

Thank you in advance!

@evan-masseau
Copy link
Contributor

evan-masseau commented Jan 30, 2025

Hey folks thanks for your interest and for your patience. I’m working on an intermediate fix to get this broken codegen out of the way and enable our SDK to work as a NativeModule in bridgeless mode on the new architecture while we work toward the longer term solution of adopting turbo modules. I expect to have an alpha branch available shortly that early adopters could test their build against. Right now I am just putting it through some tests including the bug-repro provided in this thread, and making sure that with any changes to fix Android, iOS is still fully working too.

@evan-masseau evan-masseau linked a pull request Jan 31, 2025 that will close this issue
7 tasks
@evan-masseau
Copy link
Contributor

I’m back with good news! We are testing out this branch now, having already confirmed that the in-repo example app and the provided bug-repo in this thread build on the new architecture for iOS and Android. We have some further checks to run through before we make an official public release, but wanted to bring it you your attention sooner than later.
If any early adopters are up for helping us verify the branch works in your apps, it’d help build confidence that this change is working for a wide variety of react native apps. Appreciate any help you can provide!
I expect to publish an alpha to npm first thing next week, in the meantime it can be installed from a git branch (instructions in the pull request description).

@evan-masseau evan-masseau self-assigned this Jan 31, 2025
@evan-masseau evan-masseau linked a pull request Jan 31, 2025 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working evergreen
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants