ammarahm-ed / react-native-jsi-template

Template library and blog that explain how JSI modules are built from scratch in React Native
https://blog.notesnook.com/getting-started-react-native-jsi/
MIT License
163 stars 24 forks source link

react-native/android' to contain exactly one file, however, it contains no files. #19

Closed psquizzle closed 1 year ago

psquizzle commented 1 year ago

FAILURE: [RUN_GRADLEW] Build failed with an exception. [RUN_GRADLEW] Where: [RUN_GRADLEW] Build file '/private/var/folders/rl/9tgdr27n0nj7lm5mt4t58tr80000gn/T/eas-build-local-nodejs/d8ea3b8a-82fb-4da9-834a-99ac0e13c510/build/node_modules/react-native-jsi-template/android/build.gradle' line: 114 [RUN_GRADLEW] What went wrong: [RUN_GRADLEW] A problem occurred evaluating project ':react-native-jsi-template'. [RUN_GRADLEW] > Expected directory '/private/var/folders/rl/9tgdr27n0nj7lm5mt4t58tr80000gn/T/eas-build-local-nodejs/d8ea3b8a-82fb-4da9-834a-99ac0e13c510/build/node_modules/react-native/android' to contain exactly one file, however, it contains no files. [RUN_GRADLEW] Try: [RUN_GRADLEW] > Run with --stacktrace option to get the stack trace. [RUN_GRADLEW] > Run with --info or --debug [RUN_GRADLEW] option to get more log output. [RUN_GRADLEW] > Run with --scan to get full insights. [RUN_GRADLEW] Get more help at https://help.gradle.org [RUN_GRADLEW] BUILD FAILED in 23s [RUN_GRADLEW] 5 actionable tasks: 5 executed [RUN_GRADLEW] Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Build failed Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information. Error: npx exited with non-zero code: 1

psquizzle commented 1 year ago

This seems to be due to the following:

The /android folder inside react-native

Starting from React Native 0.71, we're not shipping the /android folder inside the React Native NPM package anymore due to sizing constraints on NPM. The Android artifacts are distributed via Maven Central. You can read more about it in this RFC: https://github.com/react-native-community/discussions-and-proposals/pull/508

If you're a library author and you're manipulating the React Native .aar files, to extract headers, extract .so files or do anything with it, you're probably doing something wrong. React Native 0.71 ships with all the necessary logic to let you consume it transparently by just using:

implementation("com.facebook.react:react-android")
// or to keep backward compatibility with older versions of React Native:
implementation("com.facebook.react:react-native:+")

You should consider refactoring your library code not to unzip/manipulate the React Native .aar files.

This README.md file is kept in this folder as some libraries are checking the existence of the /android folder and failing user builds if the folder is missing.

I am however not sure how to refactor instead.