maxs15 / maxs15/react-native-spinkit

Use of package name in rnpm-prelink.sh

Open
#38 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
2.4k
Forks
307
PR merge metrics
No merged PRs in 30d

Description

I encountered the following issue when linking the module for Android in my current project:

react-native link react-native-spinkit
RNSpinkit checking app version ..
RNSpinkit patching MainApplication.java ..

<PROJECT_PATH>/node_modules/react-native-spinkit/scripts/rnpm-prelink.js:71
    throw 'RNSpinkit could not link Android automatically, MainApplication.java not found in path : ' + APPLICATION_MAIN
    ^
RNSpinkit could not link Android automatically, MainApplication.java not found in path : <PROJECT_PATH>/android/app/src/main/java/com/<PACKAGE_NAME>/MainApplication.java
<PROJECT_PATH>/node_modules/react-native/local-cli/core/makeCommand.js:19
        throw new Error(`Error occured during executing "${ command }" command`);
        ^

Error: Error occured during executing "node ./node_modules/react-native-spinkit/scripts/rnpm-prelink.js" command
    at ChildProcess.prelink (<PROJECT_PATH>/node_modules/react-native/local-cli/core/makeCommand.js:19:15)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

It turns out that the problem was that the script assumes that your project name is the same as the package name, which wasn't the case in my project (the package name had a suffix, -mobile) in the package name to avoid package naming collisions.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/rnpm-prelink.js around line 71 and trace how the Android MainApplication.java path is assembled during react-native link. Reproduce the case where the project name and package name differ, then verify that linking locates the actual application package and completes without this error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.