achorein / expo-share-intent

🚀 Simple share intent in an Expo Native Module
MIT License
119 stars 10 forks source link

Issues with eas build --platform android #81

Closed cback97 closed 6 days ago

cback97 commented 1 week ago

Describe the bug

  1. having the auto linking config in the package.json causes a failure in the prebuild step, removing the expo auto linking config in the package.json then fails in the gradlew step.

To Reproduce eas build --platform android

Package.json

{
  "name": "bright-green-frontend",
  "main": "expo-router/entry",
  "license": "UNLICENSED",
  "version": "1.0.0",
  "scripts": {
    "start": "export NODE_ENV=development; export EXPO_PUBLIC_LIVE_BACKEND=false; expo start",
    "start-test": "export NODE_ENV=test; export EXPO_PUBLIC_LIVE_BACKEND=true; expo start --web",
    "live": "export NODE_ENV=development; export EXPO_PUBLIC_LIVE_BACKEND=true; expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "export NODE_ENV=development; expo start --web",
    "clean-dev": "npx expo prebuild --no-install --clean",
    "ios-dev": "./scripts/run-native-ios.sh",
    "android-dev": "npx expo run:android --no-build-cache",
    "test": "jest",
    "check-types": "tsc -p tsconfig.json --noEmit",
    "lint": "yarn check-types; eslint .",
    "build:web": "npx expo export -p web",
    "build-common": "(cd ../common; yarn; yarn build);",
    "build-api": "(cd ../backend/functions/api; yarn; yarn build);",
    "build-webhooks": "(cd ../backend/functions/webhooks; yarn; yarn build);",
    "prepare": "git config --local core.hooksPath .githooks",
    "bc": "yarn build-common",
    "eas-build-pre-install": "./scripts/eas-build-pre-install.sh",
    "eas-build-post-install": "./scripts/eas-build-post-install.sh",
    "doctor": "npx expo-doctor@latest",
    "upgrade-expo": "yarn add expo@latest",
    "upgrade-fix-deps": "npx expo install --fix",
    "postinstall": "yarn build-common ; yarn build-api ; yarn build-webhooks ; ./scripts/add-ts-nocheck.sh ; patch-package"
  },
  "dependencies": {
    "@babel/runtime": "^7.23.8",
    "@expo/match-media": "^0.4.0",
    "@expo/vector-icons": "^14.0.0",
    "@googlemaps/polyline-codec": "^1.0.28",
    "@gorhom/bottom-sheet": "^4",
    "@react-google-maps/api": "^2.19.3",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/slider": "4.5.2",
    "@react-navigation/drawer": "^6.6.4",
    "@react-navigation/native": "^6.0.2",
    "@reduxjs/toolkit": "^2.0.1",
    "@stripe/react-stripe-js": "^2.6.2",
    "@stripe/stripe-js": "^3.2.0",
    "@stripe/stripe-react-native": "0.37.2",
    "@tanstack/react-query": "^4.36.1",
    "@trpc/client": "10.45.2",
    "@trpc/react-query": "10.45.2",
    "@trpc/server": "10.45.2",
    "add": "^2.0.6",
    "axios": "^1.6.5",
    "bg-kiosk": "https://github.com/SecretLab-com/bg-kiosk.git#main",
    "expo": "~51.0.11",
    "expo-asset": "~10.0.8",
    "expo-clipboard": "~6.0.3",
    "expo-constants": "~16.0.2",
    "expo-font": "~12.0.7",
    "expo-haptics": "~13.0.1",
    "expo-image": "~1.12.11",
    "expo-image-picker": "~15.0.5",
    "expo-linear-gradient": "~13.0.2",
    "expo-linking": "~6.3.1",
    "expo-localization": "~15.0.3",
    "expo-location": "~17.0.1",
    "expo-privacy-manifest-polyfill-plugin": "^0.0.2",
    "expo-router": "~3.5.15",
    "expo-share-intent": "^2.1.1",
    "expo-sharing": "~12.0.1",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.6",
    "expo-updates": "~0.25.16",
    "expo-web-browser": "~13.0.3",
    "firebase": "^10.7.1",
    "libphonenumber-js": "^1.10.58",
    "patch-package": "^8.0.0",
    "postinstall-postinstall": "^2.1.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.2",
    "react-native-country-picker-modal": "^2.0.0",
    "react-native-draggable-flatlist": "^4.0.1",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-gifted-charts": "^1.4.10",
    "react-native-maps": "1.14.0",
    "react-native-open-maps": "^0.4.3",
    "react-native-paper": "^5.12.3",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-reanimated": "~3.10.1",
    "react-native-safe-area-context": "4.10.1",
    "react-native-screens": "3.31.1",
    "react-native-svg": "15.2.0",
    "react-native-web": "~0.19.6",
    "react-native-webview": "13.8.6",
    "react-phone-number-input": "^3.3.9",
    "react-query": "^3.39.3",
    "react-redux": "^9.1.0",
    "react-responsive": "^9.0.2",
    "redux-persist": "^6.0.0",
    "usehooks-ts": "^2.9.4",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@babel/core": "^7.24.0",
    "@google-cloud/secret-manager": "^5.6.0",
    "@testing-library/jest-native": "^5.4.3",
    "@testing-library/react-native": "^12.4.3",
    "@types/jest": "^29.5.12",
    "@types/ngeohash": "^0.6.8",
    "@types/react": "~18.2.79",
    "@typescript-eslint/eslint-plugin": "^7.1.1",
    "@typescript-eslint/parser": "^7.1.1",
    "babel-plugin-module-resolver": "^5.0.0",
    "babel-preset-expo": "~11.0.0",
    "cypress": "^13.7.3",
    "eslint": "^8.56.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-import-resolver-typescript": "^3.6.1",
    "eslint-plugin-babel": "^5.3.1",
    "eslint-plugin-ban": "^1.6.0",
    "eslint-plugin-i18n-json": "^4.0.0",
    "eslint-plugin-i18next": "^6.0.3",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-prettier": "^5.1.3",
    "eslint-plugin-promise": "^6.1.1",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-native": "^4.1.0",
    "eslint-plugin-sort-keys-fix": "^1.1.2",
    "eslint-plugin-standard": "^5.0.0",
    "firebase-admin": "^12.1.1",
    "jest": "^29.2.1",
    "jest-expo": "~51.0.2",
    "prettier": "^3.1.1",
    "react-test-renderer": "18.2.0",
    "typescript": "~5.3.3"
  },
  "overrides": {
    "react-refresh": "~0.14.0"
  },
  "resolutions": {
    "react-refresh": "~0.14.0",
    "strip-ansi": "^6.0.0",
    "wrap-ansi": "^7.0.0",
    "string-width": "^4.1.0",
    "@react-native/babel-preset": "^0.74.1",
    "metro-resolver": "0.80.9"
  },
  "private": true
}

Additional context

failure in the gradlew build step when I remove the

"expo": { "autolinking": { "nativeModulesDir": "/" } },

from my package.json

Running 'gradlew :app:bundleRelease' in /home/expo/workingdir/build/frontend/android
Downloading https://services.gradle.org/distributions/gradle-8.6-all.zip
10%
20%.
30%.
40%.
50%.
60%.
70%.
80%.
90%.
100%
Welcome to Gradle 8.6!
Here are the highlights of this release:
 - Configurable encryption key for configuration cache
 - Build init improvements
 - Build authoring improvements
For more details see https://docs.gradle.org/8.6/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.6/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build
Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
> Task :gradle-plugin:checkKotlinGradlePluginConfigurationErrors
> Task :expo-updates-gradle-plugin:checkKotlinGradlePluginConfigurationErrors
> Task :expo-updates-gradle-plugin:pluginDescriptors
> Task :expo-updates-gradle-plugin:processResources
> Task :gradle-plugin:pluginDescriptors
> Task :gradle-plugin:processResources
> Task :gradle-plugin:compileKotlin
> Task :gradle-plugin:compileJava
NO-SOURCE
> Task :gradle-plugin:classes
> Task :gradle-plugin:jar
> Task :expo-updates-gradle-plugin:compileKotlin
> Task :expo-updates-gradle-plugin:compileJava NO-SOURCE
> Task :expo-updates-gradle-plugin:classes
> Task :expo-updates-gradle-plugin:jar
> Configure project :app
 ℹī¸  Applying gradle plugin 'expo-updates-gradle-plugin' (expo-updates@0.25.18)
> Configure project :expo-modules-core
Checking the license for package NDK (Side by side) 26.1.10909125 in /home/expo/Android/Sdk/licenses
License for package NDK (Side by side) 26.1.10909125 accepted.
Preparing "Install NDK (Side by side) 26.1.10909125 v.26.1.10909125".
"Install NDK (Side by side) 26.1.10909125 v.26.1.10909125" ready.
Installing NDK (Side by side) 26.1.10909125 in /home/expo/Android/Sdk/ndk/26.1.10909125
"Install NDK (Side by side) 26.1.10909125 v.26.1.10909125" complete.
"Install NDK (Side by side) 26.1.10909125 v.26.1.10909125" finished.
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script '/home/expo/workingdir/build/frontend/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle' line: 408
* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-share-intent'.
   > Failed to notify project evaluation listener.
      > compileSdkVersion is not specified. Please add it to build.gradle
      >
Could not get unknown property 'release' for SoftwareComponent container of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
* 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.
==============================================================================
2:
Task failed with an exception.
-----------
* Where:
Script '/home/expo/workingdir/build/frontend/node_modules/expo-modules-core/android/ExpoModulesCorePlugin.gradle' line: 85
* What went wrong:
A problem occurred configuring project ':expo'.
>
Could not get unknown property 'release' for SoftwareComponent container of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
* 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 3m 56s
10 actionable tasks: 10 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

ERROR i get when I leave the following in my package.json "expo": {

"autolinking": {
  "nativeModulesDir": "/"
}

},

yarn run v1.22.19
$ /home/expo/workingdir/build/frontend/node_modules/.bin/expo prebuild --no-install --platform android
env: load .env
env: export EXPO_PUBLIC_GOOGLE_MAPS_API_KEY
- Creating native directory (./android)
✔ Created native directory
- Updating package.json
✔ Updated package.json | no changes
- Running prebuild
✖ Prebuild failed
Error: EACCES: permission denied, scandir '/lost+found'
Error: EACCES: permission denied, scandir '/lost+found'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn expo prebuild --no-install --platform android exited with non-zero code: 1
cback97 commented 6 days ago

fixed by specifying that the nativeModulesDir was "./node_modules" in the package.json instead of default "/". I feel that should be documented at some point! :)