react-native-auth0 icon indicating copy to clipboard operation
react-native-auth0 copied to clipboard

Issue when building native Android

Open lnaidu14 opened this issue 1 year ago • 2 comments

Checklist

Description

OS: Windows 10 Java 17 Gradle 7.3

I am currently trying to integrate react-native-auth0 to my Expo project.

My current dependencies are:

"dependencies": { "@expo/vector-icons": "^14.0.0", "@react-navigation/native": "^6.0.2", "expo": "~51.0.9", "expo-camera": "~15.0.10", "expo-constants": "~16.0.2", "expo-font": "~12.0.5", "expo-linking": "~6.3.1", "expo-modules-autolinking": "^1.11.1", "expo-router": "~3.5.14", "expo-splash-screen": "~0.27.4", "expo-status-bar": "~1.12.1", "expo-system-ui": "~3.0.4", "expo-web-browser": "~13.0.3", "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.51.5", "react-native": "0.74.1", "react-native-auth0": "^3.2.1", "react-native-floating-action": "^1.22.0", "react-native-gesture-handler": "~2.16.1", "react-native-reanimated": "~3.10.1", "react-native-safe-area-context": "4.10.1", "react-native-screens": "3.31.1", "react-native-web": "~0.19.10" }, "devDependencies": { "@babel/core": "^7.20.0", "@types/jest": "^29.5.12", "@types/react": "~18.2.45", "@types/react-test-renderer": "^18.0.7", "jest": "^29.2.1", "jest-expo": "~51.0.2", "react-test-renderer": "18.2.0", "typescript": "~5.3.3" },

I'm running Java 17 and Gradle 7.3 (which is what I need to use according to the compatibility matrix. The Auth0 library only runs with native code. So when trying to build the Android native code using the Expo builder, i.e. npx expo run:android, I keep getting this error:

`npx expo run:android env: load .env env: export EXPO_PUBLIC_AUTH0_DOMAIN EXPO_PUBLIC_AUTH0_CLIENT_ID › Building app... Picked up _JAVA_OPTIONS: -Xmx512M Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • Where: Script '\node_modules\expo\scripts\autolinking.gradle' line: 4

  • What went wrong: A problem occurred evaluating script.

Could not find method exec() for arguments [autolinking_7wnwhgbtt7rc3qqznqll89fti$_run_closure1@46e55161] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

  • 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 969ms Error: \android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1 Error: \android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1 at ChildProcess.completionListener (\node_modules@expo\spawn-async\build\spawnAsync.js:42:23) at Object.onceWrapper (node:events:629:26) at ChildProcess.emit (node:events:514:28) at cp.emit (\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) ... at spawnAsync (\node_modules@expo\spawn-async\build\spawnAsync.js:7:23) at spawnGradleAsync (\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:96:48) at assembleAsync (\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:74:18) at runAndroidAsync (\node_modules@expo\cli\build\src\run\android\runAndroidAsync.js:45:37)`

I get the same result when changing directory (cd) to the android folder and running gradle build.

This is the code in my expo\scripts\autolinking.gradle:

// Resolve expo>expo-modules-autolinkingdependency chain def autolinkingPath = ["node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })"] apply from: new File( providers.exec { workingDir(rootDir) commandLine(autolinkingPath) }.standardOutput.asText.get().trim(), "../scripts/android/autolinking_implementation.gradle" )

Reproduction

  1. Install react-native-auth0
  2. Follow the quick-start guide of react-native-auth0 integration with Expo
  3. Run npx expo run:android from root project or gradle build from android folder

I'm not sure if this issue is reproducible for everyone. But it is consistently happening to me.

Additional context

I am testing all of this on both a physical and emulated version of a Pixel 7. Although I don't think it is related, as this is a build issue.

react-native-auth0 version

"react-native-auth0": "^3.2.1",

React Native version

"react-native": "0.74.1"

Expo version

"expo": "~51.0.9"

Platform

Android

Platform version(s)

14

lnaidu14 avatar Jun 02 '24 16:06 lnaidu14

For more context, this is the repository and branch I am working on https://github.com/lnaidu14/quickpay/tree/19-integrate-auth0

lnaidu14 avatar Jun 02 '24 16:06 lnaidu14

Bump

lnaidu14 avatar Jun 17 '24 16:06 lnaidu14

@lnaidu14 Now that we support bridgeless archtiecture in the latest version of the SDK, can you try again?

poovamraj avatar Jan 29 '25 19:01 poovamraj

@lnaidu14 We are going to consider this fixed for now. Feel free to comment here and we can reopen this issue if the issue persists

poovamraj avatar Feb 04 '25 17:02 poovamraj