Skip to content

Android build/Linking issue on older RN versions: PackageList.java: error: package undefined does not exist import undefined.MyPackage #429

Closed
@Tom-Bury

Description

@Tom-Bury

Description

[Issue started from a discussion at #428]

I'm facing an issue with the plain starter template for a Native UI component on Android when including the library on older React Native version apps.

I've spun up a quick test repo which consists of a plain library setup & two plain RN apps. One on the latest RN version, the other on 0.68.6. The 68.6 RN app fails to build on Android:

.../test-create-react-native-library/AwesomeOldProject/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:15: error: package undefined does not exist
import undefined.TestCreateReactNativeLibraryPackage;
                ^
.../test-create-react-native-library/AwesomeOldProject/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:61: error: cannot find symbol
      new TestCreateReactNativeLibraryPackage()

You can find the repo here: https://github.com/Tom-Bury/test-create-react-native-library

The base steps in generating it were:

  1. Generate the plain Native UI library
  2. Pack that
  3. Generate 2 RN testapps using npx [email protected] init AwesomeProject --version X.XX.X
  4. Include the tarball in both & add it as a dependency
  5. Use the library view in both App.tsx
  6. In each, try running yarn run android -> the new RN version runs fine, the old one fails

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

From the discussion wih @atlj, it seems like the issue is with the template; not per se Bob

Link to repro

https://github.com/Tom-Bury/test-create-react-native-library

Environment

``
System:
OS: macOS 13.0
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 62.55 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.0/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm
Watchman: 2023.04.10.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.12.0 - /Users/tombury/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9477386
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.18 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.6 => 0.68.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions