OpenNative / open-native

Open Native brings cross-platform communities together to help them collaborate and strengthen each other through development diversity.
https://open-native.org/
MIT License
449 stars 7 forks source link

Error android `package` in gradle 8 #29

Closed vallemar closed 2 months ago

vallemar commented 2 months ago

With the update of @nativescript/android@8.8.0-alpha.4 and the cli to the alpha versions we started using gradle 8. It seems that there is a change in how the package is declared that we now declare in AndroidManifest . Now it is declared through gradle, and that is why @open-native is failing when building the application.

First I have these errors:

Incorrect package="com.bridge" found in source AndroidManifest.xml: /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/bridge/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.bridge" from the source AndroidManifest.xml: /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/bridge/src/main/AndroidManifest.xml.
Incorrect package="com.facebook.react" found in source AndroidManifest.xml: /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/react/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.facebook.react" from the source AndroidManifest.xml: /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/react/src/main/AndroidManifest.xml.

Build completed with 2 failures.
Incorrect package="com.bridge" found in source AndroidManifest.xml: /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/bridge/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.bridge" from the source AndroidManifest.xml: /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/bridge/src/main/AndroidManifest.xml.

Unable to apply changes on device: dda76fee. Error is: Command ./gradlew failed with exit code 1.

And if I manually remove these package from the manifests I have this error

Searching for devices...
[@open-native/core/hooks/before-prepare.js] Autolinking React Native android native modules...
Error: Failed to build the app: No package name found. Found errors in /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/react/src/main/AndroidManifest.xml
    at getAndroidPackageName (/Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/hooks/android/getters/package-name.js:13:15)
    at async getPackageAutolinkInfo (/Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/hooks/android/getters/autolink-info.js:36:59)
    at async Promise.all (index 29)
    at async autolinkAndroid (/Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/hooks/android/prepare.js:16:30)
    at async module.exports (/Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/hooks/before-prepare.js:56:24)
Failed to build the app: No package name found. Found errors in /Users/vallemar/workspaces/fly-monorepo/apps/fly-app/node_modules/@open-native/core/react-android/react/src/main/AndroidManifest.xml
vallemar commented 2 months ago

Fixed with @open-native/core@2.0.0-alpha.32 and @nativescript/android@8.8.0-alpha.5.

Thank @ammarahm-ed !!!!!