callstack / callstack/react-native-builder-bob

Android Nitro Module wrong package path created

Open
#852 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
3.2k
Forks
228
Avg merge
7d 12h
Merged PRs (30d)
3

Description

### Description

I just created a new library with Nitro modules, after running Nitrogen, I start Android project, and it's throwing:

```
/Users/james/Code/Personal/react-native/react-native-app-nitro/example/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:14: error: cannot find symbol
import com.margelo.nitro.appnitro.AppNitroPackage;
^
symbol: class AppNitroPackage
location: package com.margelo.nitro.appnitro
/Users/james/Code/Personal/react-native/react-native-app-nitro/example/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:62: error: cannot find symbol
new AppNitroPackage(),
```

I found that it tries to `import com.margelo.nitro.appnitro.AppNitroPackage;`, but the generated project, the AppNitroPackage is in wrong folder:

![Image](https://github.com/user-attachments/assets/0711c1ea-f9d2-4e91-9367-7b582a1789e7)

I manually move the file to the expected folder and able to run Android

### Packages

- [x] create-react-native-library
- [ ] react-native-builder-bob

### Selected options

Nitro Module

### Link to repro

NA

### Environment

Macbook M1

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Nitro Module generation entry point used by Nitrogen and compare the generated AppNitroPackage location with the import in the generated Android PackageList.java. Reproduce the Android build from the reported create-react-native-library setup if possible; done means the generated package path and import match so the project builds without manually moving the file.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
build-system, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.