我一直在尝试在android中使用react native创建一个简单的登录,但是gradle无法编译expo附带的基本项目。我需要在模拟器上测试 Firebase 登录/登录配置,并且编译对于构建应用程序至关重要。
重现步骤:
npx create-expo-app login-test-app
npx expo prebuild
npx expo run:android
我在尝试构建应用程序时解决了很多错误,但对于这个我似乎找不到答案。我尝试删除里面的.cxx文件夹 ode_modules xpo-modules-core ndroid,但对我不起作用。还尝试重新安装react-native-animated,将项目更改为较短的目录。
这就是我所得到的:
PS C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app> npx expo run:android
› Building app...
Picked up _JAVA_OPTIONS: -Xmx2048M
Configuration on demand is an incubating feature.
> Configure project :expo
Using expo modules
- expo-asset (10.0.10)
- expo-constants (16.0.2)
- expo-file-system (17.0.1)
- expo-font (12.0.10)
- expo-keep-awake (13.0.2)
- expo-modules-core (1.12.24)
- expo-splash-screen (0.27.5)
- expo-system-ui (3.0.7)
- expo-web-browser (13.0.3)
> Configure project :react-native-reanimated
Android gradle plugin: 8.2.1
Gradle: 8.8
> Task :expo-modules-core:configureCMakeDebug[arm64-v8a] FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':expo-modules-core:configureCMakeDebug[arm64-v8a]'.
> [CXX1210] C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\node_modules\expo-modules-core\android\CMakeLists.txt debug|arm64-v8a : No compatible library foun
* 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.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 27s
301 actionable tasks: 88 executed, 205 from cache, 8 up-to-date
Error: C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\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: C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\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 (C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\node_modules\@expo\spawn-async\build\spawnAsync.js:42:23)
at Object.onceWrapper (node:events:634:26)
at ChildProcess.emit (node:events:519:28)
at cp.emit (C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5)
...
at spawnAsync (C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\node_modules\@expo\spawn-async\build\spawnAsync.js:7:23)
at spawnGradleAsync (C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:96:48)
at assembleAsync (C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:74:18)
at runAndroidAsync (C:\Users\Sofia\Desktop\Universidad\Memoria\login-test-app\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:45:37)
我期望的是在模拟器上运行代码,并且 gradle 成功编译项目。
我终于解决了这个问题!我在环境变量 - >系统变量中添加了一个变量,试图解决我的旧问题,变量:_JAVA_OPTIONS,Valor:-Xmx2048m。删除这个解决了我的问题。希望它可以帮助任何也遇到此问题的人。