-
Notifications
You must be signed in to change notification settings - Fork 210
Android build/Linking issue on older RN versions: PackageList.java: error: package undefined does not exist import undefined.MyPackage #429
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
Comments
Were you also able to verify whether iOS works properly? |
Haven't tested iOS yet |
The code generating the When looking at the two app's lockfiles, there's big version changes for In the old 0.68.6 RN app:
In the newest RN app:
|
Don't have much time left, so will pick up back on Monday. For now it seemed like the missing package name from the libraries |
This might be tied to the Android Gradle Plugin version. The whole story:
So basically with Android Gradle Plugin Version 8 (Which is going to be used with RN 0.73+), the package name from the manifest is deprecated. You use the namespace on build.gradle files instead. It seems like our efforts to support this change might have broken the backward compatibility though. And here is the original issue: react-native-community/discussions-and-proposals#671 Thank you for detecting it. We'll see what can be done. |
add the package definition to the AndroidManifest.xml of my Native UI library -- works for me. |
@HancleLee Yes but now the issue is, it will raise a warning for library consumers that use newer versions of React Native while building on Android. While this might be a temporary solution, a better solution might be needed for |
The React Native CLI relies on the filename `AndroidManifest.xml` to be able parse the package name. But we were using `AndroidManifestLegacy.xml` instead which broke the lib for older RN versions (AGP 7). This change makes it so that we use `AndroidManifest.xml` for older RN versions and `AndroidManifestNew.xml` for newer RN versions. Fixes #429
### Summary The React Native CLI relies on the filename `AndroidManifest.xml` to be able parse the package name. But we were using `AndroidManifestLegacy.xml` instead which broke the lib for older RN versions (AGP 7). This change makes it so that we use `AndroidManifest.xml` for older RN versions and `AndroidManifestNew.xml` for newer RN versions. Fixes #429 ### Test plan - Create an app with RN 0.68 and install the library without these changes - see that `yarn android` fails - Create an app with RN 0.68 and install the library with these changes - see that `yarn android` succeeds - Create an app with latest RN and install the library with these changes - see that `yarn android` succeeds
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:
You can find the repo here: https://github.com/Tom-Bury/test-create-react-native-library
The base steps in generating it were:
npx react-native@X.XX.X init AwesomeProject --version X.XX.X
Packages
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
The text was updated successfully, but these errors were encountered: