Skip to content

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

Closed
@adrianso

Description

@adrianso

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

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions