nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Pathes are always ../nitrogen

Open carl-sauter opened this issue 11 months ago • 8 comments

Hey there I noticed that all pathes from nitrogen starts always with ../nitrogen. When using nitro modules in an existing app rather than as standalone library Your build.gradle an CMakeLists.txt is located under android/app/. So nitrogen is under ../../nitrogen.

Is there anyway to prevent this?

carl-sauter avatar Mar 05 '25 14:03 carl-sauter

I mean - is that a problem? You can move your nitro.json to any folder you'd like.

mrousavy avatar Mar 05 '25 18:03 mrousavy

But I do have a --out parameter in Nitrogen CLI - that allows you to choose a different location for the nitrogen/ folder.

The CMakeLists extension will still have a ../nitrogen relative path tho because I don't know where your gradle project is - the assumption is that it's one level deeper.

mrousavy avatar Mar 05 '25 18:03 mrousavy

No don't get me wrong I like that the nitrogen folder is at the root. But the build.gradle as well as the CMakeLists.txt is located under android/app and the generated Cmake file from nitrogen references the files with ../nitrogen. So I have to manually change the path to ../../nitrogen, if I want to use nitro modules in a non library scenario.

carl-sauter avatar Mar 05 '25 18:03 carl-sauter

Makes sense. Hm

mrousavy avatar Mar 05 '25 18:03 mrousavy

So any chance to get a workaround for this?

carl-sauter avatar Mar 07 '25 12:03 carl-sauter

This not only makes sense, it especially makes sense. All guides on how to write a React Native module instruct me to create a single Gradle project, but none of them can be individually imported into Android Studio because they fail at the step apply plugin: "com.facebook.react". This seems to require includeBuild @react-native/gradle-plugin in settings.gradle to work properly, but it's supposed to be a single Gradle project. I don't understand how others write Android native code without using Android Studio at all - this should be the development approach with the least friction. I'm a beginner, and I really hope I'm completely wrong here—so someone can tell me the right way to do this.

YowaiCoder avatar Mar 30 '25 09:03 YowaiCoder

You need to use it from an example app, not open the gradle project of the library directly @fightingcat

mrousavy avatar Mar 30 '25 10:03 mrousavy